public class UtilCompatibleJdk15 extends Object implements UtilCompatible
UtilCompatible
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 in Util
, and not instantiate it at all.
Constructor and Description |
---|
UtilCompatibleJdk15() |
Modifier and Type | Method and Description |
---|---|
<T extends Comparable<T>> |
binarySearch(T[] ts,
int start,
int end,
T t)
As
Arrays.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, like
IdentityHashMap ,
compares keys using identity. |
Timer |
newTimer(String name,
boolean isDaemon)
Equivalent to
Timer.Timer(String, boolean) . |
String |
quotePattern(String s) |
<T> void |
threadLocalRemove(ThreadLocal<T> threadLocal)
Removes a thread local from the current thread.
|
public BigDecimal makeBigDecimalFromDouble(double d)
makeBigDecimalFromDouble
in interface UtilCompatible
d
- input doublepublic String quotePattern(String s)
quotePattern
in interface UtilCompatible
public <T> T getAnnotation(Method method, String annotationClassName, T defaultValue)
getAnnotation
in interface UtilCompatible
public String generateUuidString()
generateUuidString
in interface UtilCompatible
public <T> T compileScript(Class<T> iface, String script, String engineName)
UtilCompatible
compileScript
in interface UtilCompatible
T
- Interfaceiface
- Interface script should implementscript
- Script codeengineName
- Name of engine (e.g. "JavaScript")public <T> void threadLocalRemove(ThreadLocal<T> threadLocal)
UtilCompatible
From JDK 1.5 onwards, calls ThreadLocal.remove()
; before
that, no-ops.
threadLocalRemove
in interface UtilCompatible
T
- TypethreadLocal
- Thread localpublic Util.MemoryInfo getMemoryInfo()
UtilCompatible
MemoryPoolMXBean
.getMemoryInfo
in interface UtilCompatible
public Timer newTimer(String name, boolean isDaemon)
UtilCompatible
Timer.Timer(String, boolean)
.
(Introduced in JDK 1.5.)newTimer
in interface UtilCompatible
name
- the name of the associated threadisDaemon
- true if the associated thread should run as a daemonpublic void cancelStatement(Statement stmt)
UtilCompatible
Util
.cancelStatement
in interface UtilCompatible
stmt
- The statement to close.public <T> Set<T> newIdentityHashSet()
UtilCompatible
IdentityHashMap
,
compares keys using identity.newIdentityHashSet
in interface UtilCompatible
T
- Element typepublic <T extends Comparable<T>> int binarySearch(T[] ts, int start, int end, T t)
UtilCompatible
Arrays.binarySearch(Object[], int, int, Object)
, but
available pre-JDK 1.6.binarySearch
in interface UtilCompatible
Copyright © 2018 Hitachi Vantara. All rights reserved.