01: /*
02: * Copyright (C) 2007 XStream Committers.
03: * All rights reserved.
04: *
05: * The software in this package is published under the terms of the BSD
06: * style license a copy of which has been included with this distribution in
07: * the LICENSE.txt file.
08: *
09: * Created on 10. April 2007 by Guilherme Silveira
10: */
11: package com.thoughtworks.xstream.converters.reflection;
12:
13: import java.util.Map;
14:
15: /**
16: * An interface capable of sorting fields. Implement this interface if you want to customize the
17: * field order in which XStream serializes objects.
18: *
19: * @author Guilherme Silveira
20: * @since 1.2.2
21: */
22: public interface FieldKeySorter {
23:
24: /**
25: * Sort the fields of a type. The method will be called with the class type that contains
26: * all the fields and a Map that retains the order in which the elements have been added.
27: * The sequence in which elements are returned by an iterator defines the processing order
28: * of the fields. An implementation may create a different Map with similar semantic, add
29: * all elements of the original map and return the new one.
30: *
31: * @param type the class that contains all the fields
32: * @param keyedByFieldKey a Map containing a {@link FieldKey} as key element and a
33: * {@link java.lang.reflect.Field} as value.
34: * @return a Map with all the entries of the original Map
35: * @since 1.2.2
36: */
37: Map sort(Class type, Map keyedByFieldKey);
38:
39: }
|