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 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)
<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
BigDecimal makeBigDecimalFromDouble(double d)
-
generateUuidString
String generateUuidString()
-
cancelStatement
void cancelStatement(Statement stmt)
Cancels and closes a SQL Statement object. If errors are encountered, they should be logged underUtil
.- 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 implementscript
- Script codeengineName
- 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, likeIdentityHashMap
, compares keys using identity.- Type Parameters:
T
- Element type- Returns:
- Set
-
binarySearch
<T extends Comparable<T>> int binarySearch(T[] ts, int start, int end, T t)
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
Timer newTimer(String name, boolean isDaemon)
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
-
-