Package org.simpleframework.xml.core
Interface Group
- All Known Implementing Classes:
GroupExtractor
interface Group
The
Group
interface represents a group of labels
associated with a particular union annotation. A group allows
a Label
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
Modifier and TypeMethodDescriptionThis is used to acquire aLabelMap
containing the labels available to the group.This is used to acquire aLabel
based on the type of an object.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
This is used to determine if an annotated list is a text list.toString()
This returns a string representation of the union group.
-
Method Details
-
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
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
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:
Exception
-
getText
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:
Exception
-
toString
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.
-