Class PureJavaReflectionProvider
java.lang.Object
com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider
- All Implemented Interfaces:
ReflectionProvider
- Direct Known Subclasses:
SunLimitedUnsafeReflectionProvider
Pure Java ObjectFactory that instantiates objects using standard Java reflection, however the types of objects that
can be constructed are limited.
Can newInstance: classes with public visibility, outer classes, static inner classes, classes with default constructors and any class that implements java.io.Serializable.
Cannot newInstance: classes without public visibility, non-static inner classes, classes without default constructors. Note that any code in the constructor of a class will be executed when the ObjectFactory instantiates the object.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface ReflectionProvider
ReflectionProvider.Visitor -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanfieldDefinedInClass(String fieldName, Class type) Deprecated.protected booleanfieldModifiersSupported(Field field) Returns a field defined in some class.getFieldOrNull(Class definedIn, String fieldName) Returns a field defined in some class.getFieldType(Object object, String fieldName, Class definedIn) protected voidinit()private ObjectnewInstance(Class type) Creates a new instance of the specified type.private ObjectvoidsetFieldDictionary(FieldDictionary dictionary) protected voidvalidateFieldAccess(Field field) voidvisitSerializableFields(Object object, ReflectionProvider.Visitor visitor) voidwriteField(Object object, String fieldName, Object value, Class definedIn)
-
Field Details
-
objectStreamClassCache
-
serializedDataCache
-
fieldDictionary
-
-
Constructor Details
-
PureJavaReflectionProvider
public PureJavaReflectionProvider() -
PureJavaReflectionProvider
-
-
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- Parameters:
type- the type to instantiate- Returns:
- a new instance of this type
-
instantiateUsingSerialization
-
visitSerializableFields
- Specified by:
visitSerializableFieldsin interfaceReflectionProvider
-
writeField
- Specified by:
writeFieldin interfaceReflectionProvider
-
getFieldType
- Specified by:
getFieldTypein interfaceReflectionProvider
-
fieldDefinedInClass
Deprecated.As of 1.4.5, usegetFieldOrNull(Class, String)instead- Specified by:
fieldDefinedInClassin interfaceReflectionProvider
-
fieldModifiersSupported
-
validateFieldAccess
-
getField
Description copied from interface:ReflectionProviderReturns a field defined in some class.- Specified by:
getFieldin interfaceReflectionProvider- Parameters:
definedIn- class where the field was definedfieldName- field name- Returns:
- the field itself
-
getFieldOrNull
Description copied from interface:ReflectionProviderReturns a field defined in some class.- Specified by:
getFieldOrNullin interfaceReflectionProvider- Parameters:
definedIn- class where the field was definedfieldName- field name- Returns:
- the field itself or null
-
setFieldDictionary
-
readResolve
-
init
protected void init()
-
getFieldOrNull(Class, String)instead