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
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 ReflectionProvider
ReflectionProvider.Visitor -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Exceptionprotected static final sun.misc.UnsafeFields inherited from class PureJavaReflectionProvider
fieldDictionary -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnewInstance(Class type) Creates a new instance of the specified type.private Objectprotected voidvalidateFieldAccess(Field field) Methods inherited from class PureJavaReflectionProvider
fieldDefinedInClass, fieldModifiersSupported, getField, getFieldOrNull, getFieldType, init, setFieldDictionary, visitSerializableFields, writeField
-
Field Details
-
unsafe
protected static final sun.misc.Unsafe unsafe -
exception
-
-
Constructor Details
-
SunLimitedUnsafeReflectionProvider
public SunLimitedUnsafeReflectionProvider()- Since:
- 1.4.7
-
SunLimitedUnsafeReflectionProvider
- Since:
- 1.4.7
-
-
Method Details
-
newInstance
Description copied from interface:ReflectionProviderCreates a new instance of the specified type. It is in the responsibility of the implementation how such an instance is created.- Specified by:
newInstancein interfaceReflectionProvider- Overrides:
newInstancein classPureJavaReflectionProvider- Parameters:
type- the type to instantiate- Returns:
- a new instance of this type
-
validateFieldAccess
- Overrides:
validateFieldAccessin classPureJavaReflectionProvider
-
readResolve
-