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