public class PureJavaReflectionProvider extends Object implements ReflectionProvider
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.
ReflectionProvider.Visitor
Modifier and Type | Field and Description |
---|---|
protected FieldDictionary |
fieldDictionary |
Constructor and Description |
---|
PureJavaReflectionProvider() |
PureJavaReflectionProvider(FieldDictionary fieldDictionary) |
Modifier and Type | Method and Description |
---|---|
boolean |
fieldDefinedInClass(String fieldName,
Class type)
Deprecated.
As of 1.4.5, use
getFieldOrNull(Class, String) instead |
protected boolean |
fieldModifiersSupported(Field field) |
Field |
getField(Class definedIn,
String fieldName)
Returns a field defined in some class.
|
Field |
getFieldOrNull(Class definedIn,
String fieldName)
Returns a field defined in some class.
|
Class |
getFieldType(Object object,
String fieldName,
Class definedIn) |
protected void |
init() |
Object |
newInstance(Class type)
Creates a new instance of the specified type.
|
void |
setFieldDictionary(FieldDictionary dictionary) |
protected void |
validateFieldAccess(Field field) |
void |
visitSerializableFields(Object object,
ReflectionProvider.Visitor visitor) |
void |
writeField(Object object,
String fieldName,
Object value,
Class definedIn) |
protected FieldDictionary fieldDictionary
public PureJavaReflectionProvider()
public PureJavaReflectionProvider(FieldDictionary fieldDictionary)
public Object newInstance(Class type)
ReflectionProvider
newInstance
in interface ReflectionProvider
type
- the type to instantiatepublic void visitSerializableFields(Object object, ReflectionProvider.Visitor visitor)
visitSerializableFields
in interface ReflectionProvider
public void writeField(Object object, String fieldName, Object value, Class definedIn)
writeField
in interface ReflectionProvider
public Class getFieldType(Object object, String fieldName, Class definedIn)
getFieldType
in interface ReflectionProvider
public boolean fieldDefinedInClass(String fieldName, Class type)
getFieldOrNull(Class, String)
insteadfieldDefinedInClass
in interface ReflectionProvider
protected boolean fieldModifiersSupported(Field field)
protected void validateFieldAccess(Field field)
public Field getField(Class definedIn, String fieldName)
ReflectionProvider
getField
in interface ReflectionProvider
definedIn
- class where the field was definedfieldName
- field namepublic Field getFieldOrNull(Class definedIn, String fieldName)
ReflectionProvider
getFieldOrNull
in interface ReflectionProvider
definedIn
- class where the field was definedfieldName
- field namepublic void setFieldDictionary(FieldDictionary dictionary)
protected void init()
Copyright © 2004–2016 XStream. All rights reserved.