public class SunLimitedUnsafeReflectionProvider extends PureJavaReflectionProvider
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).
ReflectionProvider.Visitor
Modifier and Type | Field and Description |
---|---|
protected static Exception |
exception |
protected static sun.misc.Unsafe |
unsafe |
fieldDictionary
Constructor and Description |
---|
SunLimitedUnsafeReflectionProvider() |
SunLimitedUnsafeReflectionProvider(FieldDictionary fieldDictionary) |
Modifier and Type | Method and Description |
---|---|
Object |
newInstance(Class type)
Creates a new instance of the specified type.
|
protected void |
validateFieldAccess(Field field) |
fieldDefinedInClass, fieldModifiersSupported, getField, getFieldOrNull, getFieldType, init, setFieldDictionary, visitSerializableFields, writeField
protected static final sun.misc.Unsafe unsafe
protected static final Exception exception
public SunLimitedUnsafeReflectionProvider()
public SunLimitedUnsafeReflectionProvider(FieldDictionary fieldDictionary)
public Object newInstance(Class type)
ReflectionProvider
newInstance
in interface ReflectionProvider
newInstance
in class PureJavaReflectionProvider
type
- the type to instantiateprotected void validateFieldAccess(Field field)
validateFieldAccess
in class PureJavaReflectionProvider
Copyright © 2004–2017 XStream. All rights reserved.