KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thoughtworks > xstream > mapper > Mapper


1 package com.thoughtworks.xstream.mapper;
2
3 public interface Mapper {
4
5     /**
6      * How a class name should be represented in its serialized form.
7      */

8     String JavaDoc serializedClass(Class JavaDoc type);
9
10     /**
11      * How a serialized class representation should be mapped back to a real class.
12      */

13     Class JavaDoc realClass(String JavaDoc elementName);
14
15     /**
16      * How a class member should be represented in its serialized form.
17      */

18     String JavaDoc serializedMember(Class JavaDoc type, String JavaDoc memberName);
19
20     /**
21      * How a serialized member representation should be mapped back to a real member.
22      */

23     String JavaDoc realMember(Class JavaDoc type, String JavaDoc serialized);
24
25     /**
26      * Whether this type is a simple immutable value (int, boolean, String, URL, etc.
27      * Immutable types will be repeatedly written in the serialized stream, instead of using object references.
28      */

29     boolean isImmutableValueType(Class JavaDoc type);
30
31     Class JavaDoc defaultImplementationOf(Class JavaDoc type);
32
33     String JavaDoc attributeForImplementationClass();
34
35     String JavaDoc attributeForClassDefiningField();
36
37     String JavaDoc attributeForReadResolveField();
38
39     String JavaDoc attributeForEnumType();
40
41     /**
42      * Get the name of the field that acts as the default collection for an object, or return null if there is none.
43      *
44      * @param definedIn owning type
45      * @param itemType item type
46      * @param itemFieldName optional item element name
47      */

48     String JavaDoc getFieldNameForItemTypeAndName(Class JavaDoc definedIn, Class JavaDoc itemType, String JavaDoc itemFieldName);
49
50     Class JavaDoc getItemTypeForItemFieldName(Class JavaDoc definedIn, String JavaDoc itemFieldName);
51
52     ImplicitCollectionMapping getImplicitCollectionDefForFieldName(Class JavaDoc itemType, String JavaDoc fieldName);
53
54     /**
55      * Determine whether a specific member should be serialized.
56      *
57      * @since 1.2
58      */

59     boolean shouldSerializeMember(Class JavaDoc definedIn, String JavaDoc fieldName);
60
61     interface ImplicitCollectionMapping {
62         String JavaDoc getFieldName();
63         String JavaDoc getItemFieldName();
64         Class JavaDoc getItemType();
65     }
66
67 }
68
Popular Tags