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
Modifier and TypeMethodDescription<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.<T> T
getAnnotation
(Method method, String annotationClassName, T defaultValue) Creates an object from which to get information about system memory use.makeBigDecimalFromDouble
(double d) <T> Set<T>
Creates a hash set that, likeIdentityHashMap
, compares keys using identity.Equivalent toTimer(String, boolean)
.<T> void
threadLocalRemove
(ThreadLocal<T> threadLocal) Removes a thread local from the current thread.
-
Method Details
-
makeBigDecimalFromDouble
-
quotePattern
-
getAnnotation
-
generateUuidString
String generateUuidString() -
cancelStatement
Cancels and closes a SQL Statement object. If errors are encountered, they should be logged underUtil
.- Parameters:
stmt
- The statement to close.
-
compileScript
Compiles a script to yield a Java interface.- 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
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
Creates a hash set that, likeIdentityHashMap
, compares keys using identity.- Type Parameters:
T
- Element type- Returns:
- Set
-
binarySearch
AsArrays.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, usesMemoryPoolMXBean
.- Returns:
- Memory info
-
newTimer
Equivalent toTimer(String, boolean)
. (Introduced in JDK 1.5.)- Parameters:
name
- the name of the associated threadisDaemon
- true if the associated thread should run as a daemon- Returns:
- timer
-