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

public Interface PropertySorter

Known Direct Implementers
com.thoughtworks.xstream.converters.javabean.ComparingPropertySorter, com.thoughtworks.xstream.converters.javabean.NativePropertySorter
Imports
java.beans.PropertyDescriptor, java.util.Map

An interface capable of sorting Java bean properties. Implement this interface if you want to customize the order in which XStream serializes the properties of a bean.
Author
Jörg Schaible
Since
1.4

Method Summary

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

Returns:

the sorted nameMap
sort
(Class<T>
the bean class that contains all the properties
type
,
Map<K, V>
the map to sort, key is the property name, value the PropertyDescriptor
nameMap
)

Sort the properties of a bean type.

Method Detail

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

Sort the properties of a bean type. The method will be called with the class type that contains all the properties 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 properties. 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 bean class that contains all the properties

nameMap:Map<K, V>

the map to sort, key is the property name, value the PropertyDescriptor

Returns:Map<K, V>

the sorted nameMap

Since
1.4