Class JVM
- java.lang.Object
-
- com.thoughtworks.xstream.core.JVM
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
JVM.Test
-
Field Summary
Fields Modifier and Type Field Description private static StringCodec
base64Codec
private static boolean
canAllocateWithUnsafe
private static boolean
canCreateDerivedObjectOutputStream
private static boolean
canParseISO8601TimeZoneInDateFormat
private static boolean
canParseUTCDateFormat
private static boolean
canWriteWithUnsafe
private static float
DEFAULT_JAVA_VERSION
private static boolean
isAWTAvailable
private static boolean
isSQLAvailable
private static boolean
isSwingAvailable
private static float
majorJavaVersion
private static boolean
optimizedTreeMapPutAll
private static boolean
optimizedTreeSetAddAll
private ReflectionProvider
reflectionProvider
private static java.lang.Class
reflectionProviderType
private static boolean
reverseFieldOrder
private static java.lang.String
vendor
-
Constructor Summary
Constructors Constructor Description JVM()
Deprecated.As of 1.4.5 use the static methods of JVM.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ReflectionProvider
bestReflectionProvider()
Deprecated.As of 1.4.5 usenewReflectionProvider()
static boolean
canCreateDerivedObjectOutputStream()
static boolean
canParseISO8601TimeZoneInDateFormat()
static boolean
canParseUTCDateFormat()
private static boolean
canUseSunLimitedUnsafeReflectionProvider()
private static boolean
canUseSunUnsafeReflectionProvider()
void
flushCache()
Deprecated.As of 1.4.5 no functionalitystatic StringCodec
getBase64Codec()
Get an available Base64 implementation.private static float
getMajorJavaVersion()
Parses the java version system property to determine the major java version, i.e.static java.lang.Class
getStaxInputFactory()
Get the XMLInputFactory implementation used normally by the current Java runtime as standard.static java.lang.Class
getStaxOutputFactory()
Get the XMLOutputFactory implementation used normally by the current Java runtime as standard.static boolean
hasOptimizedTreeMapPutAll()
Checks if TreeMap.putAll is optimized for SortedMap argument.static boolean
hasOptimizedTreeSetAddAll()
Checks if TreeSet.addAll is optimized for SortedSet argument.static boolean
is14()
Deprecated.As of 1.4.4, minimal JDK version is 1.4 alreadystatic boolean
is15()
Deprecated.As of 1.4.4, minimal JDK version will be 1.7 for next major releasestatic boolean
is16()
Deprecated.As of 1.4.4, minimal JDK version will be 1.7 for next major releasestatic boolean
is17()
Deprecated.As of 1.4.10, minimal JDK version will be 1.7 for next major releasestatic boolean
is18()
Deprecated.As of 1.4.11 useisVersion(int)
.static boolean
is19()
Deprecated.As of 1.4.10 useisVersion(int)
.static boolean
is9()
Deprecated.As of 1.4.11 useisVersion(int)
private static boolean
isAndroid()
static boolean
isAWTAvailable()
Checks if AWT is available.private static boolean
isIBM()
static boolean
isSQLAvailable()
Checks if SQL is available.static boolean
isSwingAvailable()
Checks if Swing is available.static boolean
isVersion(int version)
Checks current runtime against provided major Java version.java.lang.Class
loadClass(java.lang.String name)
Deprecated.As of 1.4.5 useloadClassForName(String)
java.lang.Class
loadClass(java.lang.String name, boolean initialize)
Deprecated.As of 1.4.5 useloadClassForName(String, boolean)
static java.lang.Class
loadClassForName(java.lang.String name)
Load a XStream class for the given name.static java.lang.Class
loadClassForName(java.lang.String name, boolean initialize)
Load a XStream class for the given name.static void
main(java.lang.String[] args)
static ReflectionProvider
newReflectionProvider()
Create the best matching ReflectionProvider.static ReflectionProvider
newReflectionProvider(FieldDictionary dictionary)
Create the best matching ReflectionProvider.static boolean
reverseFieldDefinition()
Deprecated.As of 1.4.5boolean
supportsAWT()
Deprecated.As of 1.4.5 useisAWTAvailable()
boolean
supportsSQL()
Deprecated.As of 1.4.5 useisSQLAvailable()
boolean
supportsSwing()
Deprecated.As of 1.4.5 useisSwingAvailable()
-
-
-
Field Detail
-
reflectionProvider
private ReflectionProvider reflectionProvider
-
isAWTAvailable
private static final boolean isAWTAvailable
-
isSwingAvailable
private static final boolean isSwingAvailable
-
isSQLAvailable
private static final boolean isSQLAvailable
-
canAllocateWithUnsafe
private static final boolean canAllocateWithUnsafe
-
canWriteWithUnsafe
private static final boolean canWriteWithUnsafe
-
optimizedTreeSetAddAll
private static final boolean optimizedTreeSetAddAll
-
optimizedTreeMapPutAll
private static final boolean optimizedTreeMapPutAll
-
canParseUTCDateFormat
private static final boolean canParseUTCDateFormat
-
canParseISO8601TimeZoneInDateFormat
private static final boolean canParseISO8601TimeZoneInDateFormat
-
canCreateDerivedObjectOutputStream
private static final boolean canCreateDerivedObjectOutputStream
-
vendor
private static final java.lang.String vendor
-
majorJavaVersion
private static final float majorJavaVersion
-
DEFAULT_JAVA_VERSION
private static final float DEFAULT_JAVA_VERSION
- See Also:
- Constant Field Values
-
reverseFieldOrder
private static final boolean reverseFieldOrder
- See Also:
- Constant Field Values
-
reflectionProviderType
private static final java.lang.Class reflectionProviderType
-
base64Codec
private static final StringCodec base64Codec
-
-
Method Detail
-
getMajorJavaVersion
private static final float getMajorJavaVersion()
Parses the java version system property to determine the major java version, i.e. 1.x- Returns:
- A float of the form 1.x
-
is14
public static boolean is14()
Deprecated.As of 1.4.4, minimal JDK version is 1.4 already
-
is15
public static boolean is15()
Deprecated.As of 1.4.4, minimal JDK version will be 1.7 for next major release
-
is16
public static boolean is16()
Deprecated.As of 1.4.4, minimal JDK version will be 1.7 for next major release
-
is17
public static boolean is17()
Deprecated.As of 1.4.10, minimal JDK version will be 1.7 for next major release- Since:
- 1.4
-
is18
public static boolean is18()
Deprecated.As of 1.4.11 useisVersion(int)
.- Since:
- 1.4
-
is19
public static boolean is19()
Deprecated.As of 1.4.10 useisVersion(int)
.- Since:
- 1.4.8
-
is9
public static boolean is9()
Deprecated.As of 1.4.11 useisVersion(int)
- Since:
- 1.4.10
-
isVersion
public static boolean isVersion(int version)
Checks current runtime against provided major Java version.- Parameters:
version
- the requested major Java version- Returns:
- true if current runtime is at least the provided major version
- Since:
- 1.4.11
-
isIBM
private static boolean isIBM()
-
isAndroid
private static boolean isAndroid()
- Since:
- 1.4
-
loadClassForName
public static java.lang.Class loadClassForName(java.lang.String name)
Load a XStream class for the given name.This method is not meant to use loading arbitrary classes. It is used by XStream bootstrap until it is able to use the user provided or the default
ClassLoader
.- Since:
- 1.4.5
-
loadClass
public java.lang.Class loadClass(java.lang.String name)
Deprecated.As of 1.4.5 useloadClassForName(String)
-
loadClassForName
public static java.lang.Class loadClassForName(java.lang.String name, boolean initialize)
Load a XStream class for the given name.This method is not meant to use loading arbitrary classes. It is used by XStream bootstrap until it is able to use the user provided or the default
ClassLoader
.- Since:
- 1.4.5
-
loadClass
public java.lang.Class loadClass(java.lang.String name, boolean initialize)
Deprecated.As of 1.4.5 useloadClassForName(String, boolean)
- Since:
- 1.4.4
-
newReflectionProvider
public static ReflectionProvider newReflectionProvider()
Create the best matching ReflectionProvider.- Returns:
- a new instance
- Since:
- 1.4.5
-
newReflectionProvider
public static ReflectionProvider newReflectionProvider(FieldDictionary dictionary)
Create the best matching ReflectionProvider.- Parameters:
dictionary
- the FieldDictionary to use by the ReflectionProvider- Returns:
- a new instance
- Since:
- 1.4.5
-
getStaxInputFactory
public static java.lang.Class getStaxInputFactory() throws java.lang.ClassNotFoundException
Get the XMLInputFactory implementation used normally by the current Java runtime as standard.In contrast to XMLInputFactory.newFactory() this method will ignore any implementations provided with the system property javax.xml.stream.XMLInputFactory, implementations configured in lib/stax.properties or registered with the Service API.
- Returns:
- the XMLInputFactory implementation or null
- Throws:
java.lang.ClassNotFoundException
- if the standard class cannot be found- Since:
- 1.4.5
-
getStaxOutputFactory
public static java.lang.Class getStaxOutputFactory() throws java.lang.ClassNotFoundException
Get the XMLOutputFactory implementation used normally by the current Java runtime as standard.In contrast to XMLOutputFactory.newFactory() this method will ignore any implementations provided with the system property javax.xml.stream.XMLOutputFactory, implementations configured in lib/stax.properties or registered with the Service API.
- Returns:
- the XMLOutputFactory implementation or null
- Throws:
java.lang.ClassNotFoundException
- if the standard class cannot be found- Since:
- 1.4.5
-
getBase64Codec
public static StringCodec getBase64Codec()
Get an available Base64 implementation. Prefers java.util.Base64 over DataTypeConverter from JAXB over XStream's own implementation.- Returns:
- a Base64 codec implementation
- Since:
- 1.4.11
-
bestReflectionProvider
public ReflectionProvider bestReflectionProvider()
Deprecated.As of 1.4.5 usenewReflectionProvider()
-
canUseSunUnsafeReflectionProvider
private static boolean canUseSunUnsafeReflectionProvider()
-
canUseSunLimitedUnsafeReflectionProvider
private static boolean canUseSunLimitedUnsafeReflectionProvider()
-
reverseFieldDefinition
public static boolean reverseFieldDefinition()
Deprecated.As of 1.4.5
-
isAWTAvailable
public static boolean isAWTAvailable()
Checks if AWT is available.- Since:
- 1.4.5
-
supportsAWT
public boolean supportsAWT()
Deprecated.As of 1.4.5 useisAWTAvailable()
Checks if the JVM supports AWT.
-
isSwingAvailable
public static boolean isSwingAvailable()
Checks if Swing is available.- Since:
- 1.4.5
-
supportsSwing
public boolean supportsSwing()
Deprecated.As of 1.4.5 useisSwingAvailable()
Checks if the JVM supports Swing.
-
isSQLAvailable
public static boolean isSQLAvailable()
Checks if SQL is available.- Since:
- 1.4.5
-
supportsSQL
public boolean supportsSQL()
Deprecated.As of 1.4.5 useisSQLAvailable()
Checks if the JVM supports SQL.
-
hasOptimizedTreeSetAddAll
public static boolean hasOptimizedTreeSetAddAll()
Checks if TreeSet.addAll is optimized for SortedSet argument.- Since:
- 1.4
-
hasOptimizedTreeMapPutAll
public static boolean hasOptimizedTreeMapPutAll()
Checks if TreeMap.putAll is optimized for SortedMap argument.- Since:
- 1.4
-
canParseUTCDateFormat
public static boolean canParseUTCDateFormat()
-
canParseISO8601TimeZoneInDateFormat
public static boolean canParseISO8601TimeZoneInDateFormat()
- Since:
- 1.4.8
-
canCreateDerivedObjectOutputStream
public static boolean canCreateDerivedObjectOutputStream()
- Since:
- 1.4.6
-
flushCache
public void flushCache()
Deprecated.As of 1.4.5 no functionality- Specified by:
flushCache
in interfaceCaching
-
main
public static void main(java.lang.String[] args)
-
-