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 Detail

      • makeBigDecimalFromDouble

        BigDecimal makeBigDecimalFromDouble​(double d)
      • getAnnotation

        <T> T getAnnotation​(Method method,
                            String annotationClassName,
                            T defaultValue)
      • generateUuidString

        String generateUuidString()
      • cancelStatement

        void cancelStatement​(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​(Class<T> iface,
                            String script,
                            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​(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> Set<T> newIdentityHashSet()
        Creates a hash set that, like IdentityHashMap, compares keys using identity.
        Type Parameters:
        T - Element type
        Returns:
        Set
      • 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

        Timer newTimer​(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