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

public Class FieldDictionary

extends Object
implements Caching
Class Inheritance
All Implemented Interfaces
com.thoughtworks.xstream.core.Caching
Imports
java.lang.reflect.Field, .Modifier, java.util.Collections, .HashMap, .Iterator, .LinkedList, .Map, com.thoughtworks.xstream.core.Caching, .JVM, com.thoughtworks.xstream.core.util.OrderRetainingMap

A field dictionary instance caches information about classes fields.
Authors
Joe Walnes, Jörg Schaible, Guilherme Silveira

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
pack-priv static interface

Field Summary

Modifier and TypeField and Description
private transient Map<K, V>
private transient FieldDictionary.FieldUtil
private static final FieldDictionary.DictionaryEntry
private final FieldKeySorter

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
private FieldDictionary.DictionaryEntry
buildDictionaryEntryForClass(final Class<T> cls, final FieldDictionary.DictionaryEntry lastDictionaryEntry)

private Map<K, V>
buildMap(final Class<T> type, final boolean tupleKeyed)

public Field

Returns:

the field itself
field
(final Class<T>
the class where the field is to be searched
cls
,
final String
the field name
name
,
final Class<T>
the superclass (or the class itself) of cls where the field was defined
definedIn
)

Returns an specific field of some class.

public Field

Returns:

the field itself or null
fieldOrNull
(final Class<T>
the class where the field is to be searched
cls
,
final String
the field name
name
,
final Class<T>
the superclass (or the class itself) of cls where the field was defined
definedIn
)

Returns an specific field of some class.

public Iterator<E>

Returns:

an iterator for its fields
fieldsFor
(final Class<T>
the class you are interested on
cls
)

Returns an iterator for all fields for some class

public synchronized void
private synchronized FieldDictionary.DictionaryEntry
getDictionaryEntry(final Class<T> cls)

private void
init()

protected Object
public Iterator<E>

Returns:

an iterator for its fields
serializableFieldsFor
(final Class<T>
the class you are interested on
cls
)

Deprecated As of 1.3, use fieldsFor(Class) instead
Returns an iterator for all fields for some class
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dictionaryEntriesback to summary
private transient Map<K, V> dictionaryEntries
fieldUtilback to summary
private transient FieldDictionary.FieldUtil fieldUtil
OBJECT_DICTIONARY_ENTRYback to summary
private static final FieldDictionary.DictionaryEntry OBJECT_DICTIONARY_ENTRY
sorterback to summary
private final FieldKeySorter sorter

Constructor Detail

FieldDictionaryback to summary
public FieldDictionary()
FieldDictionaryback to summary
public FieldDictionary(final FieldKeySorter sorter)

Method Detail

buildDictionaryEntryForClassback to summary
private FieldDictionary.DictionaryEntry buildDictionaryEntryForClass(final Class<T> cls, final FieldDictionary.DictionaryEntry lastDictionaryEntry)
buildMapback to summary
private Map<K, V> buildMap(final Class<T> type, final boolean tupleKeyed)
fieldback to summary
public Field field(final Class<T> cls, final String name, final Class<T> definedIn)

Returns an specific field of some class. If definedIn is null, it searches for the field named 'name' inside the class cls. If definedIn is different than null, tries to find the specified field name in the specified class cls which should be defined in class definedIn (either equals cls or a one of it's superclasses)

Parameters
cls:Class<T>

the class where the field is to be searched

name:String

the field name

definedIn:Class<T>

the superclass (or the class itself) of cls where the field was defined

Returns:Field

the field itself

Exceptions
ObjectAccessException:
if no field can be found
fieldOrNullback to summary
public Field fieldOrNull(final Class<T> cls, final String name, final Class<T> definedIn)

Returns an specific field of some class. If definedIn is null, it searches for the field named 'name' inside the class cls. If definedIn is different than null, tries to find the specified field name in the specified class cls which should be defined in class definedIn (either equals cls or a one of it's superclasses)

Parameters
cls:Class<T>

the class where the field is to be searched

name:String

the field name

definedIn:Class<T>

the superclass (or the class itself) of cls where the field was defined

Returns:Field

the field itself or null

Since
1.4
fieldsForback to summary
public Iterator<E> fieldsFor(final Class<T> cls)

Returns an iterator for all fields for some class

Parameters
cls:Class<T>

the class you are interested on

Returns:Iterator<E>

an iterator for its fields

flushCacheback to summary
public synchronized void flushCache()

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

getDictionaryEntryback to summary
private synchronized FieldDictionary.DictionaryEntry getDictionaryEntry(final Class<T> cls)
initback to summary
private void init()
readResolveback to summary
protected Object readResolve()
serializableFieldsForback to summary
public Iterator<E> serializableFieldsFor(final Class<T> cls)

Deprecated

As of 1.3, use fieldsFor(Class) instead

Returns an iterator for all fields for some class

Parameters
cls:Class<T>

the class you are interested on

Returns:Iterator<E>

an iterator for its fields

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

private final Class FieldDictionary.DictionaryEntry

extends Object
Class Inheritance
  • java.lang.Object
  • com.thoughtworks.xstream.converters.reflection.FieldDictionary.DictionaryEntry

Field Summary

Modifier and TypeField and Description
private final Map<K, V>
private final Map<K, V>

Constructor Summary

AccessConstructor and Description
public
DictionaryEntry(final Map<K, V> keyedByFieldName, final Map<K, V> keyedByFieldKey)

Method Summary

Modifier and TypeMethod and Description
public Map<K, V>
public Map<K, V>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

keyedByFieldKeyback to summary
private final Map<K, V> keyedByFieldKey
keyedByFieldNameback to summary
private final Map<K, V> keyedByFieldName

Constructor Detail

DictionaryEntryback to summary
public DictionaryEntry(final Map<K, V> keyedByFieldName, final Map<K, V> keyedByFieldKey)

Method Detail

getKeyedByFieldKeyback to summary
public Map<K, V> getKeyedByFieldKey()
getKeyedByFieldNameback to summary
public Map<K, V> getKeyedByFieldName()
com.thoughtworks.xstream.converters.reflection back to summary

pack-priv Interface FieldDictionary.FieldUtil

Known Direct Implementers
com.thoughtworks.xstream.converters.reflection.FieldUtil14, com.thoughtworks.xstream.converters.reflection.FieldUtil15

Method Summary

Modifier and TypeMethod and Description
public boolean

Method Detail

isSyntheticback to summary
public boolean isSynthetic(Field field)