Interface PropertySorter

All Known Implementing Classes:
ComparingPropertySorter, NativePropertySorter

public interface PropertySorter
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.
Since:
1.4
  • Method Summary

    Modifier and Type
    Method
    Description
    sort(Class type, Map nameMap)
    Sort the properties of a bean type.
  • Method Details

    • sort

      Map sort(Class type, Map 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 - the bean class that contains all the properties
      nameMap - the map to sort, key is the property name, value the PropertyDescriptor
      Returns:
      the sorted nameMap
      Since:
      1.4