Top Inners Fields Constructors Methods
com.thoughtworks.xstream.converters.reflection

public abstract Class AbstractReflectionConverter

extends Object
implements Converter, Caching
Class Inheritance
All Implemented Interfaces
com.thoughtworks.xstream.core.Caching, com.thoughtworks.xstream.converters.Converter, com.thoughtworks.xstream.converters.ConverterMatcher
Known Direct Subclasses
com.thoughtworks.xstream.converters.reflection.ReflectionConverter, com.thoughtworks.xstream.converters.reflection.SerializableConverter
Imports
com.thoughtworks.xstream.converters.ConversionException, .Converter, .MarshallingContext, .SingleValueConverter, .UnmarshallingContext, com.thoughtworks.xstream.core.Caching, .ReferencingMarshallingContext, com.thoughtworks.xstream.core.util.ArrayIterator, .FastField, .Fields, .HierarchicalStreams, .Primitives, .SerializationMembers, com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriterHelper, .HierarchicalStreamReader, .HierarchicalStreamWriter, com.thoughtworks.xstream.mapper.CannotResolveClassException, .Mapper, java.lang.reflect.Array, .Field, .Modifier, java.util.AbstractList, .ArrayList, .Collection, .Collections, .HashMap, .HashSet, .Iterator, .List, .Map, .Set

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
public static class
AbstractReflectionConverter.DuplicateFieldException

Deprecated as a consequence of ConversionException being deprecated.
private static class
private static class
private static interface
private class
public static class
AbstractReflectionConverter.UnknownFieldException

Deprecated as a consequence of ConversionException being deprecated.

Field Summary

Modifier and TypeField and Description
protected final Mapper
private transient ReflectionProvider
protected final ReflectionProvider
protected transient SerializationMembers
protected transient SerializationMethodInvoker
serializationMethodInvoker

Deprecated As of 1.4.8, use serializationMembers.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected boolean
canAccess(Class<T> type)

protected void
doMarshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context)

public Object
doUnmarshal(final Object result, final HierarchicalStreamReader reader, final UnmarshallingContext context)

public void
private void
handleUnknownField(Class<T> classDefiningField, String fieldName, Class<T> resultType, String originalNodeName)

protected Object
public void
marshal(Object
The object to be marshalled.
original
,
final HierarchicalStreamWriter
A stream to write to.
writer
,
final MarshallingContext
A context that allows nested objects to be processed by XStream.
context
)

Implements com.thoughtworks.xstream.converters.Converter.marshal.

Convert an object to textual data.
protected void
marshallField(final MarshallingContext context, Object newObj, Field field)

private Class<T>
protected Object
protected boolean
protected boolean
public Object
unmarshal(final HierarchicalStreamReader
The stream to read the text from.
reader
,
final UnmarshallingContext context)

Implements com.thoughtworks.xstream.converters.Converter.unmarshal.

Convert textual data back into an object.
protected Object
unmarshallField(final UnmarshallingContext context, final Object result, Class<T> type, Field field)

private void
writeValueToImplicitCollection(Object value, Map<K, V> implicitCollections, Object result, final AbstractReflectionConverter.FieldLocation fieldLocation)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mapperback to summary
protected final Mapper mapper
pureJavaReflectionProviderback to summary
private transient ReflectionProvider pureJavaReflectionProvider
reflectionProviderback to summary
protected final ReflectionProvider reflectionProvider
serializationMembersback to summary
protected transient SerializationMembers serializationMembers
serializationMethodInvokerback to summary
protected transient SerializationMethodInvoker serializationMethodInvoker

Deprecated

As of 1.4.8, use serializationMembers.

Constructor Detail

AbstractReflectionConverterback to summary
public AbstractReflectionConverter(Mapper mapper, ReflectionProvider reflectionProvider)

Method Detail

canAccessback to summary
protected boolean canAccess(Class<T> type)
doMarshalback to summary
protected void doMarshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context)
doUnmarshalback to summary
public Object doUnmarshal(final Object result, final HierarchicalStreamReader reader, final UnmarshallingContext context)
flushCacheback to summary
public void flushCache()

Implements com.thoughtworks.xstream.core.Caching.flushCache.

handleUnknownFieldback to summary
private void handleUnknownField(Class<T> classDefiningField, String fieldName, Class<T> resultType, String originalNodeName)
instantiateNewInstanceback to summary
protected Object instantiateNewInstance(HierarchicalStreamReader reader, UnmarshallingContext context)
marshalback to summary
public void marshal(Object original, final HierarchicalStreamWriter writer, final MarshallingContext context)

Implements com.thoughtworks.xstream.converters.Converter.marshal.

Doc from com.thoughtworks.xstream.converters.Converter.marshal.

Convert an object to textual data.

Parameters
original:Object

The object to be marshalled.

writer:HierarchicalStreamWriter

A stream to write to.

context:MarshallingContext

A context that allows nested objects to be processed by XStream.

marshallFieldback to summary
protected void marshallField(final MarshallingContext context, Object newObj, Field field)
readDeclaringClassback to summary
private Class<T> readDeclaringClass(HierarchicalStreamReader reader)
readResolveback to summary
protected Object readResolve()
shouldUnmarshalFieldback to summary
protected boolean shouldUnmarshalField(Field field)
shouldUnmarshalTransientFieldsback to summary
protected boolean shouldUnmarshalTransientFields()
unmarshalback to summary
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context)

Implements com.thoughtworks.xstream.converters.Converter.unmarshal.

Doc from com.thoughtworks.xstream.converters.Converter.unmarshal.

Convert textual data back into an object.

Parameters
reader:HierarchicalStreamReader

The stream to read the text from.

Returns:Object

The resulting object.

unmarshallFieldback to summary
protected Object unmarshallField(final UnmarshallingContext context, final Object result, Class<T> type, Field field)
writeValueToImplicitCollectionback to summary
private void writeValueToImplicitCollection(Object value, Map<K, V> implicitCollections, Object result, final AbstractReflectionConverter.FieldLocation fieldLocation)
com.thoughtworks.xstream.converters.reflection back to summary

private Class AbstractReflectionConverter.ArraysList

extends ArrayList
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Class<T>

Constructor Summary

AccessConstructor and Description
pack-priv
ArraysList(Class<T> physicalFieldType)

Method Summary

Modifier and TypeMethod and Description
pack-priv Object
Inherited from java.util.ArrayList:
addaddaddAlladdAlladdFirstaddLastclearclonecontainsensureCapacityequalsforEachgetgetFirstgetLasthashCodeindexOfisEmptyiteratorlastIndexOflistIteratorlistIteratorremoveremoveremoveAllremoveFirstremoveIfremoveLastremoveRangereplaceAllretainAllsetsizesortspliteratorsubListtoArraytoArraytrimToSize

Field Detail

physicalFieldTypeback to summary
pack-priv final Class<T> physicalFieldType

Constructor Detail

ArraysListback to summary
pack-priv ArraysList(Class<T> physicalFieldType)

Method Detail

toPhysicalArrayback to summary
pack-priv Object toPhysicalArray()
com.thoughtworks.xstream.converters.reflection back to summary

public Class AbstractReflectionConverter.DuplicateFieldException

extends ConversionException
Class Inheritance

Deprecated

as a consequence of ConversionException being deprecated. See corresponding docs for further information.

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

DuplicateFieldExceptionback to summary
public DuplicateFieldException(String msg)
com.thoughtworks.xstream.converters.reflection back to summary

private Class AbstractReflectionConverter.FieldInfo

extends FieldLocation
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Class<T>
pack-priv final Object
Inherited from com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.FieldLocation:
definedInfieldName

Constructor Summary

AccessConstructor and Description
pack-priv
FieldInfo(final String fieldName, final Class<T> type, final Class<T> definedIn, final Object value)

Method Summary

Inherited from com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.FieldLocation:
equalshashCode

Field Detail

typeback to summary
pack-priv final Class<T> type
valueback to summary
pack-priv final Object value

Constructor Detail

FieldInfoback to summary
pack-priv FieldInfo(final String fieldName, final Class<T> type, final Class<T> definedIn, final Object value)
com.thoughtworks.xstream.converters.reflection back to summary

private Class AbstractReflectionConverter.FieldLocation

extends Object
Class Inheritance
  • java.lang.Object
  • com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.FieldLocation
Known Direct Subclasses
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.FieldInfo

Field Summary

Modifier and TypeField and Description
pack-priv final Class<T>
pack-priv final String

Constructor Summary

AccessConstructor and Description
pack-priv
FieldLocation(final String fieldName, final Class<T> definedIn)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

definedInback to summary
pack-priv final Class<T> definedIn
fieldNameback to summary
pack-priv final String fieldName

Constructor Detail

FieldLocationback to summary
pack-priv FieldLocation(final String fieldName, final Class<T> definedIn)

Method Detail

equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

com.thoughtworks.xstream.converters.reflection back to summary

private Interface AbstractReflectionConverter.FieldMarshaller


Method Summary

Modifier and TypeMethod and Description
public void
writeField(final String fieldName, final String aliasName, final Class<T> fieldType, final Class<T> definedIn, final Object newObj)

public void
writeItem(final Object item)

Method Detail

writeFieldback to summary
public void writeField(final String fieldName, final String aliasName, final Class<T> fieldType, final Class<T> definedIn, final Object newObj)
writeItemback to summary
public void writeItem(final Object item)
com.thoughtworks.xstream.converters.reflection back to summary

private Class AbstractReflectionConverter.MappingList

extends AbstractList
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Map<K, V>
private final String
private final Map<K, V>
Inherited from java.util.AbstractList:
modCount

Constructor Summary

AccessConstructor and Description
public
MappingList(Map<K, V> map, String keyFieldName)

Method Summary

Modifier and TypeMethod and Description
public boolean
add(Object
element to be appended to this list
object
)

Overrides java.util.AbstractList.add.

Implements java.util.List.add, java.util.Collection.add.

Appends the specified element to the end of this list (optional operation).
public Object
get(int
index of the element to return
index
)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Returns the element at the specified position in this list.
public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.List.size, java.util.Collection.size.

Returns the number of elements in this list.
Inherited from java.util.AbstractList:
addaddAllclearequalshashCodeindexOfiteratorlastIndexOflistIteratorlistIteratorremoveremoveRangesetsubList

Field Detail

fieldCacheback to summary
private final Map<K, V> fieldCache
keyFieldNameback to summary
private final String keyFieldName
mapback to summary
private final Map<K, V> map

Constructor Detail

MappingListback to summary
public MappingList(Map<K, V> map, String keyFieldName)

Method Detail

addback to summary
public boolean add(Object object)

Overrides java.util.AbstractList.add.

Implements java.util.List.add, java.util.Collection.add.

Doc from java.util.AbstractList.add.

Appends the specified element to the end of this list (optional operation).

Lists that support this operation may place limitations on what elements may be added to this list. In particular, some lists will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. List classes should clearly specify in their documentation any restrictions on what elements may be added.

Parameters
object:Object

element to be appended to this list

Returns:boolean

true (as specified by Collection#add)

getback to summary
public Object get(int index)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Doc from java.util.AbstractList.get.

Returns the element at the specified position in this list.

Parameters
index:int

Doc from java.util.List.get.

index of the element to return

Returns:Object

Doc from java.util.List.get.

the element at the specified position in this list

sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.List.size, java.util.Collection.size.

Doc from java.util.List.size.

Returns the number of elements in this list. If this list contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this list

com.thoughtworks.xstream.converters.reflection back to summary

public Class AbstractReflectionConverter.UnknownFieldException

extends ConversionException
Class Inheritance

Deprecated

as a consequence of ConversionException being deprecated. See corresponding docs for further information.

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

UnknownFieldExceptionback to summary
public UnknownFieldException(String type, String field)