Top Description Inners Methods
com.thoughtworks.xstream.converters.reflection

public Interface ReflectionProvider

Known Direct Implementers
com.thoughtworks.xstream.converters.reflection.ReflectionProviderWrapper, com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider
Imports
java.lang.reflect.Field

Provides core reflection services.
Author
Joe Walnes

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ReflectionProvider.Visitor

A visitor interface for serializable fields defined in a class.

Method Summary

Modifier and TypeMethod and Description
public boolean
fieldDefinedInClass(String fieldName, Class<T> type)

Deprecated As of 1.4.5, use getFieldOrNull(Class, String) instead
public Field

Returns:

the field itself
getField
(Class<T>
class where the field was defined
definedIn
,
String
field name
fieldName
)

Returns a field defined in some class.

public Field

Returns:

the field itself or null
getFieldOrNull
(Class<T>
class where the field was defined
definedIn
,
String
field name
fieldName
)

Returns a field defined in some class.

public Class<T>
getFieldType(Object object, String fieldName, Class<T> definedIn)

public Object

Returns:

a new instance of this type
newInstance
(Class<T>
the type to instantiate
type
)

Creates a new instance of the specified type.

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

Method Detail

fieldDefinedInClassback to summary
public boolean fieldDefinedInClass(String fieldName, Class<T> type)

Deprecated

As of 1.4.5, use getFieldOrNull(Class, String) instead

getFieldback to summary
public Field getField(Class<T> definedIn, String fieldName)

Returns a field defined in some class.

Parameters
definedIn:Class<T>

class where the field was defined

fieldName:String

field name

Returns:Field

the field itself

Exceptions
ObjectAccessException:
if field does not exist
getFieldOrNullback to summary
public Field getFieldOrNull(Class<T> definedIn, String fieldName)

Returns a field defined in some class.

Parameters
definedIn:Class<T>

class where the field was defined

fieldName:String

field name

Returns:Field

the field itself or null

Since
1.4.5
getFieldTypeback to summary
public Class<T> getFieldType(Object object, String fieldName, Class<T> definedIn)
newInstanceback to summary
public Object newInstance(Class<T> type)

Creates a new instance of the specified type. It is in the responsibility of the implementation how such an instance is created.

Parameters
type:Class<T>

the type to instantiate

Returns:Object

a new instance of this type

visitSerializableFieldsback to summary
public void visitSerializableFields(Object object, ReflectionProvider.Visitor visitor)
writeFieldback to summary
public void writeField(Object object, String fieldName, Object value, Class<T> definedIn)
com.thoughtworks.xstream.converters.reflection back to summary

public Interface ReflectionProvider.Visitor


A visitor interface for serializable fields defined in a class.

Method Summary

Modifier and TypeMethod and Description
public void
visit(String
field name
name
,
Class<T>
field type
type
,
Class<T>
where the field was defined
definedIn
,
Object
field value
value
)

Callback for each visit

Method Detail

visitback to summary
public void visit(String name, Class<T> type, Class<T> definedIn, Object value)

Callback for each visit

Parameters
name:String

field name

type:Class<T>

field type

definedIn:Class<T>

where the field was defined

value:Object

field value