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