Top Description Fields Constructors Methods
com.thoughtworks.xstream.converters.reflection

public Class SunLimitedUnsafeReflectionProvider

extends PureJavaReflectionProvider
Class Inheritance
Known Direct Subclasses
com.thoughtworks.xstream.converters.reflection.SunUnsafeReflectionProvider
Imports
java.lang.reflect.Field, com.thoughtworks.xstream.converters.ConversionException, .ErrorWritingException, sun.misc.Unsafe

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).

Authors
Jörg Schaible, Joe Walnes, Brian Slesinsky
Since
1.4.7

Field Summary

Modifier and TypeField and Description
protected static final Exception
protected static final Unsafe
Inherited from com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider:
fieldDictionary

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public Object
private Object
protected void
Inherited from com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider:
fieldDefinedInClassfieldModifiersSupportedgetFieldgetFieldOrNullgetFieldTypeinitsetFieldDictionaryvisitSerializableFieldswriteField

Field Detail

exceptionback to summary
protected static final Exception exception
unsafeback to summary
protected static final Unsafe unsafe

Constructor Detail

SunLimitedUnsafeReflectionProviderback to summary
public SunLimitedUnsafeReflectionProvider()
Since
1.4.7
SunLimitedUnsafeReflectionProviderback to summary
public SunLimitedUnsafeReflectionProvider(FieldDictionary fieldDictionary)
Since
1.4.7

Method Detail

newInstanceback to summary
public Object newInstance(Class<T> type)

Overrides com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.newInstance.

Implements com.thoughtworks.xstream.converters.reflection.ReflectionProvider.newInstance.

Doc from com.thoughtworks.xstream.converters.reflection.ReflectionProvider.newInstance.

Creates a new instance of the specified type. It is in the responsibility of the implementation how such an instance is created.

Parameters
type:Class<T>

the type to instantiate

Returns:Object

a new instance of this type

readResolveback to summary
private Object readResolve()

Hides com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.readResolve.

validateFieldAccessback to summary
protected void validateFieldAccess(Field field)

Overrides com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.validateFieldAccess.