Package mondrian.util

Class UtilCompatibleJdk15

  • All Implemented Interfaces:
    UtilCompatible
    Direct Known Subclasses:
    UtilCompatibleJdk16

    public class UtilCompatibleJdk15
    extends java.lang.Object
    implements UtilCompatible
    Implementation of UtilCompatible which runs in JDK 1.5.

    Prior to JDK 1.5, this class should never be loaded. Applications should instantiate this class via Class.forName(String) or better, use methods in Util, and not instantiate it at all.

    Since:
    Feb 5, 2007
    Author:
    jhyde
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T extends java.lang.Comparable<T>>
      int
      binarySearch​(T[] ts, int start, int end, T t)
      As Arrays.binarySearch(Object[], int, int, Object), but available pre-JDK 1.6.
      void cancelStatement​(java.sql.Statement stmt)
      Cancels and closes a SQL Statement object.
      <T> T compileScript​(java.lang.Class<T> iface, java.lang.String script, java.lang.String engineName)
      Compiles a script to yield a Java interface.
      java.lang.String generateUuidString()  
      <T> T getAnnotation​(java.lang.reflect.Method method, java.lang.String annotationClassName, T defaultValue)  
      Util.MemoryInfo getMemoryInfo()
      Creates an object from which to get information about system memory use.
      java.math.BigDecimal makeBigDecimalFromDouble​(double d)
      This generates a BigDecimal with a precision reflecting the precision of the input double.
      <T> java.util.Set<T> newIdentityHashSet()
      Creates a hash set that, like IdentityHashMap, compares keys using identity.
      java.util.Timer newTimer​(java.lang.String name, boolean isDaemon)
      Equivalent to Timer(String, boolean).
      java.lang.String quotePattern​(java.lang.String s)  
      <T> void threadLocalRemove​(java.lang.ThreadLocal<T> threadLocal)
      Removes a thread local from the current thread.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UtilCompatibleJdk15

        public UtilCompatibleJdk15()
    • Method Detail

      • makeBigDecimalFromDouble

        public java.math.BigDecimal makeBigDecimalFromDouble​(double d)
        This generates a BigDecimal with a precision reflecting the precision of the input double.
        Specified by:
        makeBigDecimalFromDouble in interface UtilCompatible
        Parameters:
        d - input double
        Returns:
        BigDecimal
      • quotePattern

        public java.lang.String quotePattern​(java.lang.String s)
        Specified by:
        quotePattern in interface UtilCompatible
      • getAnnotation

        public <T> T getAnnotation​(java.lang.reflect.Method method,
                                   java.lang.String annotationClassName,
                                   T defaultValue)
        Specified by:
        getAnnotation in interface UtilCompatible
      • compileScript

        public <T> T compileScript​(java.lang.Class<T> iface,
                                   java.lang.String script,
                                   java.lang.String engineName)
        Description copied from interface: UtilCompatible
        Compiles a script to yield a Java interface.
        Specified by:
        compileScript in interface UtilCompatible
        Type Parameters:
        T - Interface
        Parameters:
        iface - Interface script should implement
        script - Script code
        engineName - Name of engine (e.g. "JavaScript")
        Returns:
        Object that implements given interface
      • threadLocalRemove

        public <T> void threadLocalRemove​(java.lang.ThreadLocal<T> threadLocal)
        Description copied from interface: UtilCompatible
        Removes a thread local from the current thread.

        From JDK 1.5 onwards, calls ThreadLocal.remove(); before that, no-ops.

        Specified by:
        threadLocalRemove in interface UtilCompatible
        Type Parameters:
        T - Type
        Parameters:
        threadLocal - Thread local
      • getMemoryInfo

        public Util.MemoryInfo getMemoryInfo()
        Description copied from interface: UtilCompatible
        Creates an object from which to get information about system memory use. From JDK 1.5 onwards, uses MemoryPoolMXBean.
        Specified by:
        getMemoryInfo in interface UtilCompatible
        Returns:
        Memory info
      • newTimer

        public java.util.Timer newTimer​(java.lang.String name,
                                        boolean isDaemon)
        Description copied from interface: UtilCompatible
        Equivalent to Timer(String, boolean). (Introduced in JDK 1.5.)
        Specified by:
        newTimer in interface UtilCompatible
        Parameters:
        name - the name of the associated thread
        isDaemon - true if the associated thread should run as a daemon
        Returns:
        timer
      • cancelStatement

        public void cancelStatement​(java.sql.Statement stmt)
        Description copied from interface: UtilCompatible
        Cancels and closes a SQL Statement object. If errors are encountered, they should be logged under Util.
        Specified by:
        cancelStatement in interface UtilCompatible
        Parameters:
        stmt - The statement to close.
      • newIdentityHashSet

        public <T> java.util.Set<T> newIdentityHashSet()
        Description copied from interface: UtilCompatible
        Creates a hash set that, like IdentityHashMap, compares keys using identity.
        Specified by:
        newIdentityHashSet in interface UtilCompatible
        Type Parameters:
        T - Element type
        Returns:
        Set
      • binarySearch

        public <T extends java.lang.Comparable<T>> int binarySearch​(T[] ts,
                                                                    int start,
                                                                    int end,
                                                                    T t)
        Description copied from interface: UtilCompatible
        As Arrays.binarySearch(Object[], int, int, Object), but available pre-JDK 1.6.
        Specified by:
        binarySearch in interface UtilCompatible