Package mondrian.util

Interface UtilCompatible

  • All Known Implementing Classes:
    UtilCompatibleJdk15, UtilCompatibleJdk16

    public interface UtilCompatible
    Interface containing methods which are implemented differently in different versions of the JDK.

    The methods should not be called directly, only via the corresponding static methods in Util, namely:

    This interface could in principle be extended to allow native implementations of methods, or to serve as a factory for entire classes which have different implementations in different environments.

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

      All Methods Instance Methods Abstract 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)  
      <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.
    • Method Detail

      • makeBigDecimalFromDouble

        java.math.BigDecimal makeBigDecimalFromDouble​(double d)
      • quotePattern

        java.lang.String quotePattern​(java.lang.String s)
      • getAnnotation

        <T> T getAnnotation​(java.lang.reflect.Method method,
                            java.lang.String annotationClassName,
                            T defaultValue)
      • generateUuidString

        java.lang.String generateUuidString()
      • cancelStatement

        void cancelStatement​(java.sql.Statement stmt)
        Cancels and closes a SQL Statement object. If errors are encountered, they should be logged under Util.
        Parameters:
        stmt - The statement to close.
      • compileScript

        <T> T compileScript​(java.lang.Class<T> iface,
                            java.lang.String script,
                            java.lang.String engineName)
        Compiles a script to yield a Java interface.
        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

        <T> void threadLocalRemove​(java.lang.ThreadLocal<T> threadLocal)
        Removes a thread local from the current thread.

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

        Type Parameters:
        T - Type
        Parameters:
        threadLocal - Thread local
      • newIdentityHashSet

        <T> java.util.Set<T> newIdentityHashSet()
        Creates a hash set that, like IdentityHashMap, compares keys using identity.
        Type Parameters:
        T - Element type
        Returns:
        Set
      • binarySearch

        <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.
      • getMemoryInfo

        Util.MemoryInfo getMemoryInfo()
        Creates an object from which to get information about system memory use. From JDK 1.5 onwards, uses MemoryPoolMXBean.
        Returns:
        Memory info
      • newTimer

        java.util.Timer newTimer​(java.lang.String name,
                                 boolean isDaemon)
        Equivalent to Timer(String, boolean). (Introduced in JDK 1.5.)
        Parameters:
        name - the name of the associated thread
        isDaemon - true if the associated thread should run as a daemon
        Returns:
        timer