Package org.simpleframework.xml.core
Interface Group
-
- All Known Implementing Classes:
GroupExtractor
interface Group
TheGroup
interface represents a group of labels associated with a particular union annotation. A group allows aLabel
to be acquired by name or type. Acquiring the label by type allows the serialization process to dynamically select a label, and thus converter, based on the instance type. On deserialization a label is dynamically selected based on name.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description LabelMap
getElements()
This is used to acquire aLabelMap
containing the labels available to the group.Label
getLabel(java.lang.Class type)
This is used to acquire aLabel
based on the type of an object.Label
getText()
This is used to get aLabel
that represents the text between elements on an element union.boolean
isInline()
This is used to determine if the group is inline.boolean
isTextList()
This is used to determine if an annotated list is a text list.java.lang.String
toString()
This returns a string representation of the union group.
-
-
-
Method Detail
-
isInline
boolean isInline()
This is used to determine if the group is inline. A group is inline if all of the elements in the group is inline. If any of theLabel
objects in the group is not inline then the entire group is not inline, although this is unlikely.
- Returns:
- this returns true if each label in the group is inline
-
isTextList
boolean isTextList()
This is used to determine if an annotated list is a text list. A text list is a list of elements that also accepts free text. Typically this will be an element list union that will allow unstructured XML such as XHTML to be parsed.- Returns:
- returns true if the label represents a text list
-
getLabel
Label getLabel(java.lang.Class type)
This is used to acquire aLabel
based on the type of an object. Selecting a label based on the type ensures that the serialization process can dynamically convert an object to XML. If the type is not supported, this returns null.- Parameters:
type
- this is the type to select the label from- Returns:
- this returns the label based on the type
-
getElements
LabelMap getElements() throws java.lang.Exception
This is used to acquire aLabelMap
containing the labels available to the group. Providing a context object ensures that each of the labels is mapped to a name that is styled according to its internal style.- Returns:
- this returns a label map containing the labels
- Throws:
java.lang.Exception
-
getText
Label getText() throws java.lang.Exception
This is used to get aLabel
that represents the text between elements on an element union. Providing a label here ensures that the free text found between elements can be converted in to strings and added to the list.- Returns:
- a label if a text annotation has been declared
- Throws:
java.lang.Exception
-
toString
java.lang.String toString()
This returns a string representation of the union group. Providing a string representation in this way ensures that the group can be used in exception messages and for any debugging.- Overrides:
toString
in classjava.lang.Object
- Returns:
- this returns a string representation of the group
-
-