com.thoughtworks.xstream.converters.javabean
Class BeanProvider

java.lang.Object
  extended by com.thoughtworks.xstream.converters.javabean.BeanProvider

public class BeanProvider
extends java.lang.Object

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.


Field Summary
protected static java.lang.Object[] NO_PARAMS
           
protected  PropertyDictionary propertyDictionary
           
 
Constructor Summary
BeanProvider()
           
 
Method Summary
 boolean canInstantiate(java.lang.Class type)
          Returns true if the Bean provider can instantiate the specified class
protected  java.lang.reflect.Constructor getDefaultConstrutor(java.lang.Class type)
          Returns the default constructor, or null if none is found
 java.lang.Class getPropertyType(java.lang.Object object, java.lang.String name)
           
 java.lang.Object newInstance(java.lang.Class type)
           
 boolean propertyDefinedInClass(java.lang.String name, java.lang.Class type)
           
 void visitSerializableProperties(java.lang.Object object, com.thoughtworks.xstream.converters.javabean.BeanProvider.Visitor visitor)
           
 void writeProperty(java.lang.Object object, java.lang.String propertyName, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propertyDictionary

protected PropertyDictionary propertyDictionary

NO_PARAMS

protected static final java.lang.Object[] NO_PARAMS
Constructor Detail

BeanProvider

public BeanProvider()
Method Detail

newInstance

public java.lang.Object newInstance(java.lang.Class type)

visitSerializableProperties

public void visitSerializableProperties(java.lang.Object object,
                                        com.thoughtworks.xstream.converters.javabean.BeanProvider.Visitor visitor)

writeProperty

public void writeProperty(java.lang.Object object,
                          java.lang.String propertyName,
                          java.lang.Object value)

getPropertyType

public java.lang.Class getPropertyType(java.lang.Object object,
                                       java.lang.String name)

propertyDefinedInClass

public boolean propertyDefinedInClass(java.lang.String name,
                                      java.lang.Class type)

canInstantiate

public boolean canInstantiate(java.lang.Class type)
Returns true if the Bean provider can instantiate the specified class


getDefaultConstrutor

protected java.lang.reflect.Constructor getDefaultConstrutor(java.lang.Class type)
Returns the default constructor, or null if none is found

Parameters:
type -


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