com.thoughtworks.xstream.converters.reflection
Class PureJavaReflectionProvider

java.lang.Object
  extended bycom.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider
All Implemented Interfaces:
ReflectionProvider
Direct Known Subclasses:
Sun14ReflectionProvider

public class PureJavaReflectionProvider
extends java.lang.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. 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 classes inherited from class com.thoughtworks.xstream.converters.reflection.ReflectionProvider
ReflectionProvider.Block
 
Constructor Summary
PureJavaReflectionProvider()
           
 
Method Summary
 void eachSerializableField(java.lang.Class type, ReflectionProvider.Block visitor)
           
protected  boolean fieldModifiersSupported(int modifiers)
           
protected  java.lang.reflect.Field findField(java.lang.Class cls, java.lang.String fieldName)
           
 java.lang.Class getFieldType(java.lang.Object object, java.lang.String fieldName)
           
 java.lang.Object newInstance(java.lang.Class type)
           
 java.lang.Object readField(java.lang.Object object, java.lang.String fieldName)
           
protected  void validateFieldAccess(java.lang.reflect.Field field)
           
 void writeField(java.lang.Object object, java.lang.String fieldName, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PureJavaReflectionProvider

public PureJavaReflectionProvider()
Method Detail

newInstance

public java.lang.Object newInstance(java.lang.Class type)
Specified by:
newInstance in interface ReflectionProvider

eachSerializableField

public void eachSerializableField(java.lang.Class type,
                                  ReflectionProvider.Block visitor)
Specified by:
eachSerializableField in interface ReflectionProvider

readField

public java.lang.Object readField(java.lang.Object object,
                                  java.lang.String fieldName)
Specified by:
readField in interface ReflectionProvider

writeField

public void writeField(java.lang.Object object,
                       java.lang.String fieldName,
                       java.lang.Object value)
Specified by:
writeField in interface ReflectionProvider

getFieldType

public java.lang.Class getFieldType(java.lang.Object object,
                                    java.lang.String fieldName)
Specified by:
getFieldType in interface ReflectionProvider

findField

protected java.lang.reflect.Field findField(java.lang.Class cls,
                                            java.lang.String fieldName)

fieldModifiersSupported

protected boolean fieldModifiersSupported(int modifiers)

validateFieldAccess

protected void validateFieldAccess(java.lang.reflect.Field field)


Joe Walnes, http://xstream.codehaus.org/