Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.thoughtworks.xstream.converters.reflection
Class PureJavaReflectionProvider

    java.lang.Object
      com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider

All Implemented Interfaces:
  ReflectionProvider

Direct Known Subclasses:
  HarmonyReflectionProvider, Sun14ReflectionProvider

    public class PureJavaReflectionProvider

extends 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 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.

Author:
  Joe Walnes

Nested Class Summary

Nested classes/interfaces inherited from interface com.thoughtworks.xstream.converters.reflection.ReflectionProvider
`ReflectionProvider.Visitor`

Field Summary
`protected FieldDictionary` | `fieldDictionary`

Constructor Summary
`PureJavaReflectionProvider()`
`PureJavaReflectionProvider(FieldDictionary fieldDictionary)`

Method Summary
`boolean` | `fieldDefinedInClass(String fieldName, Class type)`
`protected boolean` | `fieldModifiersSupported(Field field)`
`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.
`protected Object` | `readResolve()`
`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)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### fieldDictionary

    protected FieldDictionary fieldDictionary

Constructor Detail

### PureJavaReflectionProvider

    public PureJavaReflectionProvider()

### PureJavaReflectionProvider

    public PureJavaReflectionProvider(FieldDictionary fieldDictionary)

Method Detail

### newInstance

    public Object newInstance(Class type)

  Description copied from interface: `ReflectionProvider`
  Creates a new instance of the specified type. It is in the responsibility of the implementation how such an instance is created.

  Specified by:
    `newInstance` in interface `ReflectionProvider`
  Parameters:
    `type` - the type to instantiate
  Returns:
    a new instance of this type

### visitSerializableFields

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

  Specified by:
    `visitSerializableFields` in interface `ReflectionProvider`

### writeField

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

  Specified by:
    `writeField` in interface `ReflectionProvider`

### getFieldType

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

  Specified by:
    `getFieldType` in interface `ReflectionProvider`

### fieldDefinedInClass

    public boolean fieldDefinedInClass(String fieldName,
                                       Class type)

  Specified by:
    `fieldDefinedInClass` in interface `ReflectionProvider`

### fieldModifiersSupported

    protected boolean fieldModifiersSupported(Field field)

### validateFieldAccess

    protected void validateFieldAccess(Field field)

### getField

    public Field getField(Class definedIn,
                          String fieldName)

  Description copied from interface: `ReflectionProvider`
  Returns a field defined in some class.

  Specified by:
    `getField` in interface `ReflectionProvider`
  Parameters:
    `definedIn` - class where the field was defined
    `fieldName` - field name
  Returns:
    the field itself

### setFieldDictionary

    public void setFieldDictionary(FieldDictionary dictionary)

### readResolve

    protected Object readResolve()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2008 XStream. All Rights Reserved.