public class ImplicitCollectionFieldMapping extends Object implements com.thoughtworks.xstream.mapper.Mapper.ImplicitCollectionMapping
ItemFieldMapping defines a mapping of a class within a class to an element name. Where classes are tested, the must implement or extend the specified classes, unlike the standard behaviour of XStream they dont need to be the classes in question.
The structure is used for implicit collections of the form *
<outerobject>
<listelement>
<objectcontent>
</listelement>
<listelement>
<objectcontent>
</listelement>
...
</outerobject>
or
<person>
<emails>
<type></type>
<value></value>
</emails>
<emails>
<type></type>
<value></value>
</emails>
<emails>
<type></type>
<value></value>
</emails>
...
</person>
would be specified with NewItemFieldMapping(Person.class, "emails", ListField.class, "emails");
| Constructor and Description |
|---|
ImplicitCollectionFieldMapping(Class<?> definedIn,
String fieldName,
Class<?> itemType,
String itemFieldName)
Create a Item Field Mapping object specifying that where the class itemType
appears in the Class definedIn, the elementName should be used for the
Element Name.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getFieldName() |
String |
getItemFieldName() |
Class<?> |
getItemType() |
boolean |
matches(Class<?> definedIn,
Class<?> itemType)
Does this ItemFieldMapping match the supplied classes.
|
boolean |
matches(Class<?> definedIn,
String fieldName) |
public ImplicitCollectionFieldMapping(Class<?> definedIn, String fieldName, Class<?> itemType, String itemFieldName)
definedIn - the class which contains the methodfieldName - the name of the method/field in the class.itemType - the type of the method/field in the class.itemFieldName - the name of element in the xmlpublic boolean matches(Class<?> definedIn, Class<?> itemType)
definedIn - the class that the target test class is defiend in, this is a real
classitemType - the target class, the real classpublic String getFieldName()
getFieldName in interface com.thoughtworks.xstream.mapper.Mapper.ImplicitCollectionMappingpublic String getItemFieldName()
getItemFieldName in interface com.thoughtworks.xstream.mapper.Mapper.ImplicitCollectionMappingpublic Class<?> getItemType()
getItemType in interface com.thoughtworks.xstream.mapper.Mapper.ImplicitCollectionMappingCopyright © 2007-2012. All Rights Reserved.