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

public Interface FieldKeySorter

Known Direct Implementers
com.thoughtworks.xstream.converters.reflection.ImmutableFieldKeySorter, com.thoughtworks.xstream.converters.reflection.NativeFieldKeySorter, com.thoughtworks.xstream.converters.reflection.SortableFieldKeySorter, com.thoughtworks.xstream.converters.reflection.XStream12FieldKeySorter
Imports
java.util.Map

An interface capable of sorting fields. Implement this interface if you want to customize the field order in which XStream serializes objects.
Author
Guilherme Silveira
Since
1.2.2

Method Summary

Modifier and TypeMethod and Description
public Map<K, V>

Returns:

a Map with all the entries of the original Map
sort
(Class<T>
the class that contains all the fields
type
,
Map<K, V>
a Map containing a FieldKey as key element and a java.lang.reflect.Field as value.
keyedByFieldKey
)

Sort the fields of a type.

Method Detail

sortback to summary
public Map<K, V> sort(Class<T> type, Map<K, V> keyedByFieldKey)

Sort the fields of a type. The method will be called with the class type that contains all the fields and a Map that retains the order in which the elements have been added. The sequence in which elements are returned by an iterator defines the processing order of the fields. An implementation may create a different Map with similar semantic, add all elements of the original map and return the new one.

Parameters
type:Class<T>

the class that contains all the fields

keyedByFieldKey:Map<K, V>

a Map containing a FieldKey as key element and a java.lang.reflect.Field as value.

Returns:Map<K, V>

a Map with all the entries of the original Map

Since
1.2.2