|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) public @interface Element
The Element
annotation is used to represent a field
or method that appears as an XML element. Fields or methods that
are annotated with this can be either primitive or compound, that
is, represent an object that can be serialized and deserialized.
Below is an example of the serialized format for a compound object.
If this annotates a type that contains no XML annotations then
this will look for a suitable Transform
for the type
using the Transformer
. For instance, all primitives
and primitive arrays that are annotated with this will make use
of a transform in order to convert its value to and from suitable
XML representations.
<example class="demo.Example"> <data/> <example>Each element may have any number of attributes and sub-elements representing fields or methods of that compound object. Attribute and element names can be acquired from the annotation or, if the annotation does not explicitly declare a name, it is taken from the annotated field or method. There are exceptions in some cases, for example, the
class
attribute is reserved by the
serialization framework to represent the serialized type.
Optional Element Summary | |
---|---|
boolean |
data
This is used to determine whether the element data is written in a CDATA block or not. |
java.lang.String |
name
This represents the name of the XML element. |
boolean |
required
Determines whether the element is required within the XML document. |
java.lang.Class |
type
This represents an explicit type that should be used for the annotated field or method. |
public abstract java.lang.String name
public abstract boolean data
public abstract boolean required
public abstract java.lang.Class type
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |