See: Description
| Interface | Description |
|---|---|
| Serializer |
The
Serializer interface is used to represent objects
that can serialize and deserialize objects to an from XML. |
| Enum | Description |
|---|---|
| DefaultType |
The
DefaultType enumeration is used to specify the
type of defaults to apply to a class. |
| Annotation Type | Description |
|---|---|
| Attribute |
The
Attribute annotation represents a serializable XML
attribute within an XML element. |
| Default |
The
Default annotation is used to specify that all
fields or methods should be serialized in a default manner. |
| Element |
The
Element annotation is used to represent a field
or method that appears as an XML element. |
| ElementArray |
The
ElementArray annotation represents a method or
field that is an array of elements. |
| ElementList |
The
ElementList annotation represents a method or
field that is a Collection for storing entries. |
| ElementListUnion |
The
ElementListUnion annotation is used to describe
fields and methods that can dynamically match a schema class. |
| ElementMap |
The
ElementMap annotation represents a method or field
that is a Map for storing key value pairs. |
| ElementMapUnion |
The
ElementMapUnion annotation is used to describe a
field or method that can dynamically match a schema class. |
| ElementUnion |
The
ElementUnion annotation is used to describe fields
and methods that can dynamically match a schema class. |
| Namespace |
The
Namespace annotation is used to set a namespace
on an element or attribute. |
| NamespaceList |
The
NamespaceList annotation that is used to declare
namespaces that can be added to an element. |
| Order |
The
Order annotation is used to specify the order of
appearance of XML elements and attributes. |
| Path |
The
Path annotation is used to specify an XML path
where an XML element or attribute is located. |
| Root |
This
Root annotation is used to annotate classes that
need to be serialized. |
| Text |
The
Text annotation is used to represent a field or
method that appears as text within an XML element. |
| Transient |
The
Transient annotation is an optional annotation
that can be used within an XML class schema to mark a method or
field as being transient, which indicates that it does not take
part in serialization or deserialization. |
| Version |
The
Version annotation is used to specify an attribute
that is used to represent a revision of the class XML schema. |
@Root
public class Example {
@Attribute
private String name;
@Element
private String value;
public Example() {
super();
}
// ...
}
When a class is annotated in a similar manner to the above example it
can be converted to and from an XML document using an implementation
of the Serializer interface, which is provided in the
core package. Below is an example of the resulting XML when writing
the above annotated class.
<example name='x'>
<value>y</value>
</example>
The same instance can be recovered from the XML document at a later
stage if required. For further information on how to annotate classes
see the documentation for the annotations within this package.org.simpleframework.xml.core