Package mondrian.util
Class UtilCompatibleJdk15
- java.lang.Object
-
- mondrian.util.UtilCompatibleJdk15
-
- All Implemented Interfaces:
UtilCompatible
- Direct Known Subclasses:
UtilCompatibleJdk16
public class UtilCompatibleJdk15 extends Object implements UtilCompatible
Implementation ofUtilCompatible
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 inUtil
, and not instantiate it at all.- Since:
- Feb 5, 2007
- Author:
- jhyde
-
-
Constructor Summary
Constructors Constructor Description UtilCompatibleJdk15()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Comparable<T>>
intbinarySearch(T[] ts, int start, int end, T t)
AsArrays.binarySearch(Object[], int, int, Object)
, but available pre-JDK 1.6.void
cancelStatement(Statement stmt)
Cancels and closes a SQL Statement object.<T> T
compileScript(Class<T> iface, String script, String engineName)
Compiles a script to yield a Java interface.String
generateUuidString()
<T> T
getAnnotation(Method method, String annotationClassName, T defaultValue)
Util.MemoryInfo
getMemoryInfo()
Creates an object from which to get information about system memory use.BigDecimal
makeBigDecimalFromDouble(double d)
This generates a BigDecimal with a precision reflecting the precision of the input double.<T> Set<T>
newIdentityHashSet()
Creates a hash set that, likeIdentityHashMap
, compares keys using identity.Timer
newTimer(String name, boolean isDaemon)
Equivalent toTimer(String, boolean)
.String
quotePattern(String s)
<T> void
threadLocalRemove(ThreadLocal<T> threadLocal)
Removes a thread local from the current thread.
-
-
-
Method Detail
-
makeBigDecimalFromDouble
public BigDecimal makeBigDecimalFromDouble(double d)
This generates a BigDecimal with a precision reflecting the precision of the input double.- Specified by:
makeBigDecimalFromDouble
in interfaceUtilCompatible
- Parameters:
d
- input double- Returns:
- BigDecimal
-
quotePattern
public String quotePattern(String s)
- Specified by:
quotePattern
in interfaceUtilCompatible
-
getAnnotation
public <T> T getAnnotation(Method method, String annotationClassName, T defaultValue)
- Specified by:
getAnnotation
in interfaceUtilCompatible
-
generateUuidString
public String generateUuidString()
- Specified by:
generateUuidString
in interfaceUtilCompatible
-
compileScript
public <T> T compileScript(Class<T> iface, String script, String engineName)
Description copied from interface:UtilCompatible
Compiles a script to yield a Java interface.- Specified by:
compileScript
in interfaceUtilCompatible
- Type Parameters:
T
- Interface- Parameters:
iface
- Interface script should implementscript
- Script codeengineName
- Name of engine (e.g. "JavaScript")- Returns:
- Object that implements given interface
-
threadLocalRemove
public <T> void threadLocalRemove(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 interfaceUtilCompatible
- 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, usesMemoryPoolMXBean
.- Specified by:
getMemoryInfo
in interfaceUtilCompatible
- Returns:
- Memory info
-
newTimer
public Timer newTimer(String name, boolean isDaemon)
Description copied from interface:UtilCompatible
Equivalent toTimer(String, boolean)
. (Introduced in JDK 1.5.)- Specified by:
newTimer
in interfaceUtilCompatible
- Parameters:
name
- the name of the associated threadisDaemon
- true if the associated thread should run as a daemon- Returns:
- timer
-
cancelStatement
public void cancelStatement(Statement stmt)
Description copied from interface:UtilCompatible
Cancels and closes a SQL Statement object. If errors are encountered, they should be logged underUtil
.- Specified by:
cancelStatement
in interfaceUtilCompatible
- Parameters:
stmt
- The statement to close.
-
newIdentityHashSet
public <T> Set<T> newIdentityHashSet()
Description copied from interface:UtilCompatible
Creates a hash set that, likeIdentityHashMap
, compares keys using identity.- Specified by:
newIdentityHashSet
in interfaceUtilCompatible
- Type Parameters:
T
- Element type- Returns:
- Set
-
binarySearch
public <T extends Comparable<T>> int binarySearch(T[] ts, int start, int end, T t)
Description copied from interface:UtilCompatible
AsArrays.binarySearch(Object[], int, int, Object)
, but available pre-JDK 1.6.- Specified by:
binarySearch
in interfaceUtilCompatible
-
-