Class SunLimitedUnsafeReflectionProvider
- java.lang.Object
-
- com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider
-
- com.thoughtworks.xstream.converters.reflection.SunLimitedUnsafeReflectionProvider
-
- All Implemented Interfaces:
ReflectionProvider
- Direct Known Subclasses:
SunUnsafeReflectionProvider
public class SunLimitedUnsafeReflectionProvider extends PureJavaReflectionProvider
Instantiates a new object bypassing the constructor using undocumented internal JDK features.The code in the constructor will never be executed and parameters do not have to be known. This is the same method used by the internals of standard Java serialization, but relies on internal code (sun.misc.Unsafe) that may not be present on all JVMs.
The implementation will use standard Java functionality to write any fields. This requires Java 5 as minimum runtime and is used as fallback on platforms that do not provide the complete implementation level for the internals (like Dalvik).
- Since:
- 1.4.7
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.thoughtworks.xstream.converters.reflection.ReflectionProvider
ReflectionProvider.Visitor
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.Exception
exception
protected static sun.misc.Unsafe
unsafe
-
Fields inherited from class com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider
fieldDictionary
-
-
Constructor Summary
Constructors Constructor Description SunLimitedUnsafeReflectionProvider()
SunLimitedUnsafeReflectionProvider(FieldDictionary fieldDictionary)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
newInstance(java.lang.Class type)
Creates a new instance of the specified type.private java.lang.Object
readResolve()
protected void
validateFieldAccess(java.lang.reflect.Field field)
-
Methods inherited from class com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider
fieldDefinedInClass, fieldModifiersSupported, getField, getFieldOrNull, getFieldType, init, setFieldDictionary, visitSerializableFields, writeField
-
-
-
-
Constructor Detail
-
SunLimitedUnsafeReflectionProvider
public SunLimitedUnsafeReflectionProvider()
- Since:
- 1.4.7
-
SunLimitedUnsafeReflectionProvider
public SunLimitedUnsafeReflectionProvider(FieldDictionary fieldDictionary)
- Since:
- 1.4.7
-
-
Method Detail
-
newInstance
public java.lang.Object newInstance(java.lang.Class type)
Description copied from interface:ReflectionProvider
Creates a new instance of the specified type. It is in the responsibility of the implementation how such an instance is created.- Specified by:
newInstance
in interfaceReflectionProvider
- Overrides:
newInstance
in classPureJavaReflectionProvider
- Parameters:
type
- the type to instantiate- Returns:
- a new instance of this type
-
validateFieldAccess
protected void validateFieldAccess(java.lang.reflect.Field field)
- Overrides:
validateFieldAccess
in classPureJavaReflectionProvider
-
readResolve
private java.lang.Object readResolve()
-
-