Module com.sun.xml.bind.core
Interface ElementPropertyInfo<T,C>
-
- All Superinterfaces:
AnnotationSource,PropertyInfo<T,C>
public interface ElementPropertyInfo<T,C> extends PropertyInfo<T,C>
Property that maps to an element.- Author:
- Kohsuke Kawaguchi
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Adapter<T,C>getAdapter()List<? extends TypeRef<T,C>>getTypes()Returns the information about the types allowed in this property.QNamegetXmlName()Gets the wrapper element name.booleanisCollectionNillable()Returns true if this property is nillable (meaning the absence of the value is treated as nil='true')booleanisCollectionRequired()Checks if the wrapper element is required.booleanisRequired()Returns true if this element is mandatory.booleanisValueList()Returns true if this property is a collection but its XML representation is a list of values, not repeated elements.-
Methods inherited from interface org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource
hasAnnotation, readAnnotation
-
Methods inherited from interface org.glassfish.jaxb.core.v2.model.core.PropertyInfo
displayName, getExpectedMimeType, getName, getSchemaType, id, inlineBinaryData, isCollection, kind, parent, ref
-
-
-
-
Method Detail
-
getTypes
List<? extends TypeRef<T,C>> getTypes()
Returns the information about the types allowed in this property.In a simple case like the following, an element property only has one
TypeRefthat points toStringand tag name "foo".@XmlElement String abc;
However, in a general case an element property can be heterogeneous, meaning you can put different types in it, each with a different tag name (and a few other settings.)
// list can contain String or Integer. @XmlElements({ @XmlElement(name="a",type=String.class), @XmlElement(name="b",type=Integer.class), }) List<Object> abc;In this case this method returns a list of two
TypeRefs.- Returns:
- Always non-null. Contains at least one entry.
If
isValueList()==true, there's always exactly one type.
-
getXmlName
QName getXmlName()
Gets the wrapper element name.- Returns:
- must be null if
PropertyInfo.isCollection()==false or ifisValueList()==true. Otherwise, this can be null (in which case there'll be no wrapper), or it can be non-null (in which case there'll be a wrapper)
-
isCollectionRequired
boolean isCollectionRequired()
Checks if the wrapper element is required.- Returns:
- Always false if
getXmlName()==null.
-
isCollectionNillable
boolean isCollectionNillable()
Returns true if this property is nillable (meaning the absence of the value is treated as nil='true')This method is only used when this property is a collection.
-
isValueList
boolean isValueList()
Returns true if this property is a collection but its XML representation is a list of values, not repeated elements.If
PropertyInfo.isCollection()==false, this property is always false.When this flag is true,
getTypes().size()==1always holds.
-
isRequired
boolean isRequired()
Returns true if this element is mandatory. For collections, this property isn't used. TODO: define the semantics when this is a collection
-
getAdapter
Adapter<T,C> getAdapter()
- Specified by:
getAdapterin interfacePropertyInfo<T,C>- Returns:
- null if the property is not adapted.
-
-