public class

PureJavaReflectionProvider

extends Object
implements ReflectionProvider
java.lang.Object
   ↳ com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider
Known Direct Subclasses

Class Overview

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.

Summary

Fields
protected FieldDictionary fieldDictionary
Public Constructors
PureJavaReflectionProvider()
PureJavaReflectionProvider(FieldDictionary fieldDictionary)
Public Methods
boolean fieldDefinedInClass(String fieldName, Class type)
Field getField(Class definedIn, String fieldName)
Returns a field defined in some class.
Class getFieldType(Object object, String fieldName, Class definedIn)
Object newInstance(Class type)
Creates a new instance of the specified type.
void setFieldDictionary(FieldDictionary dictionary)
void visitSerializableFields(Object object, ReflectionProvider.Visitor visitor)
void writeField(Object object, String fieldName, Object value, Class definedIn)
Protected Methods
boolean fieldModifiersSupported(Field field)
Object readResolve()
void validateFieldAccess(Field field)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.thoughtworks.xstream.converters.reflection.ReflectionProvider

Fields

protected FieldDictionary fieldDictionary

Public Constructors

public PureJavaReflectionProvider ()

public PureJavaReflectionProvider (FieldDictionary fieldDictionary)

Public Methods

public boolean fieldDefinedInClass (String fieldName, Class type)

public Field getField (Class definedIn, String fieldName)

Returns a field defined in some class.

Parameters
definedIn class where the field was defined
fieldName field name
Returns
  • the field itself

public Class getFieldType (Object object, String fieldName, Class definedIn)

public Object newInstance (Class type)

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

Parameters
type the type to instantiate
Returns
  • a new instance of this type

public void setFieldDictionary (FieldDictionary dictionary)

public void visitSerializableFields (Object object, ReflectionProvider.Visitor visitor)

public void writeField (Object object, String fieldName, Object value, Class definedIn)

Protected Methods

protected boolean fieldModifiersSupported (Field field)

protected Object readResolve ()

protected void validateFieldAccess (Field field)