@Retention(value=RUNTIME) public @interface ElementList
ElementList
annotation represents a method or
field that is a Collection
for storing entries. The
collection object deserialized is typically of the same type as
the field. However, a class
attribute can be used to
override the field type, however the type must be assignable.
<list class="java.util.ArrayList"> <entry name="one"/> <entry name="two"/> <entry name="three"/> </list>If a
class
attribute is not provided and the type or
the field or method is abstract, a suitable match is searched for
from the collections available from the Java collections framework.
This annotation can also compose an inline list of XML elements.
An inline list contains no parent or containing element.
<entry name="one"/> <entry name="two"/> <entry name="three"/>The above XML is an example of the output for an inline list of XML elements. In such a list the annotated field or method must not be given a name. Instead the name is acquired from the name of the entry type. For example if the
type
attribute of
this was set to an object example.Entry
then the name
of the entry list would be taken as the root name of the object
as taken from the Root
annotation for that object.Modifier and Type | Optional Element and Description |
---|---|
boolean |
data
This is used to determine whether the element data is written
in a CDATA block or not.
|
boolean |
empty
This is used to determine if an optional field or method can
remain null if it does not exist.
|
String |
entry
This is used to provide a name of the XML element representing
the entry within the list.
|
boolean |
inline
Determines whether the element list is inlined with respect
to the parent XML element.
|
String |
name
This represents the name of the XML element.
|
boolean |
required
Determines whether the element is required within the XML
document.
|
Class |
type
Represents the type of object the element list contains.
|
public abstract String name
public abstract String entry
public abstract Class type
class
attribute value for the list. If
this is not specified then the type can be determined from the
generic parameter of the annotated Collection
.public abstract boolean data
public abstract boolean required
public abstract boolean inline
public abstract boolean empty