com.thoughtworks.xstream.converters.reflection
Class PureJavaReflectionProvider
java.lang.Object
com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider
- All Implemented Interfaces:
- ReflectionProvider
- Direct Known Subclasses:
- Sun14ReflectionProvider
public class PureJavaReflectionProvider
- extends Object
- implements ReflectionProvider
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.
- Author:
- Joe Walnes
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fieldDictionary
protected FieldDictionary fieldDictionary
PureJavaReflectionProvider
public PureJavaReflectionProvider()
PureJavaReflectionProvider
public PureJavaReflectionProvider(FieldDictionary fieldDictionary)
newInstance
public Object newInstance(Class type)
- Description copied from interface:
ReflectionProvider
- Creates a new instance of the specified type. It is in the responsibility
of the implementation how such an instance is created.
- Specified by:
newInstance
in interface ReflectionProvider
- Parameters:
type
- the type to instantiate
- Returns:
- a new instance of this type
visitSerializableFields
public void visitSerializableFields(Object object,
ReflectionProvider.Visitor visitor)
- Specified by:
visitSerializableFields
in interface ReflectionProvider
writeField
public void writeField(Object object,
String fieldName,
Object value,
Class definedIn)
- Specified by:
writeField
in interface ReflectionProvider
getFieldType
public Class getFieldType(Object object,
String fieldName,
Class definedIn)
- Specified by:
getFieldType
in interface ReflectionProvider
fieldDefinedInClass
public boolean fieldDefinedInClass(String fieldName,
Class type)
- Specified by:
fieldDefinedInClass
in interface ReflectionProvider
fieldModifiersSupported
protected boolean fieldModifiersSupported(Field field)
validateFieldAccess
protected void validateFieldAccess(Field field)
getField
public Field getField(Class definedIn,
String fieldName)
- Description copied from interface:
ReflectionProvider
- Returns a field defined in some class.
- Specified by:
getField
in interface ReflectionProvider
- Parameters:
definedIn
- class where the field was definedfieldName
- field name
- Returns:
- the field itself
setFieldDictionary
public void setFieldDictionary(FieldDictionary dictionary)
readResolve
protected Object readResolve()
Copyright © 2004-2014 XStream. All Rights Reserved.