com.sun.xml.bind.v2.model.impl
Class ElementPropertyInfoImpl<TypeT,ClassDeclT,FieldT,MethodT>

java.lang.Object
  extended by com.sun.xml.bind.v2.model.impl.PropertyInfoImpl<TypeT,ClassDeclT,FieldT,MethodT>
      extended by com.sun.xml.bind.v2.model.impl.ERPropertyInfoImpl<TypeT,ClassDeclT,FieldT,MethodT>
          extended by com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl<TypeT,ClassDeclT,FieldT,MethodT>
All Implemented Interfaces:
AnnotationSource, Locatable, ElementPropertyInfo<TypeT,ClassDeclT>, PropertyInfo<TypeT,ClassDeclT>, Comparable<PropertyInfoImpl>
Direct Known Subclasses:
RuntimeElementPropertyInfoImpl

 class ElementPropertyInfoImpl<TypeT,ClassDeclT,FieldT,MethodT>
extends ERPropertyInfoImpl<TypeT,ClassDeclT,FieldT,MethodT>
implements ElementPropertyInfo<TypeT,ClassDeclT>

Common ElementPropertyInfo implementation used for both APT and runtime.


Field Summary
 
Fields inherited from class com.sun.xml.bind.v2.model.impl.PropertyInfoImpl
parent, seed
 
Constructor Summary
ElementPropertyInfoImpl(ClassInfoImpl<TypeT,ClassDeclT,FieldT,MethodT> parent, PropertySeed<TypeT,ClassDeclT,FieldT,MethodT> propertySeed)
           
 
Method Summary
protected  TypeRefImpl<TypeT,ClassDeclT> createTypeRef(QName name, TypeT type, boolean isNillable, String defaultValue)
          Used by PropertyInfoImpl to create new instances of TypeRef
 List<? extends TypeRefImpl<TypeT,ClassDeclT>> getTypes()
          Returns the information about the types allowed in this property.
 boolean isRequired()
          Returns true if this element is mandatory.
 boolean isValueList()
          Returns true if this property is a collection but its XML representation is a list of values, not repeated elements.
 PropertyKind kind()
          Gets the kind of this proeprty.
protected  void link()
          Called after all the TypeInfos are collected into the governing TypeInfoSet.
 List<? extends TypeInfo<TypeT,ClassDeclT>> ref()
          List of TypeInfos that this property references.
 
Methods inherited from class com.sun.xml.bind.v2.model.impl.ERPropertyInfoImpl
getXmlName, isCollectionNillable, isCollectionRequired
 
Methods inherited from class com.sun.xml.bind.v2.model.impl.PropertyInfoImpl
calcXmlName, calcXmlName, compareTo, displayName, getAdapter, getExpectedMimeType, getIndividualType, getLocation, getName, getRawType, getSchemaType, getUpstream, hasAnnotation, id, inlineBinaryData, isCollection, nav, parent, readAnnotation, reader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.xml.bind.v2.model.core.ElementPropertyInfo
getAdapter, getXmlName, isCollectionNillable, isCollectionRequired
 
Methods inherited from interface com.sun.xml.bind.v2.model.core.PropertyInfo
displayName, getExpectedMimeType, getName, getSchemaType, id, inlineBinaryData, isCollection, parent
 
Methods inherited from interface com.sun.xml.bind.v2.model.annotation.AnnotationSource
hasAnnotation, readAnnotation
 

Constructor Detail

ElementPropertyInfoImpl

ElementPropertyInfoImpl(ClassInfoImpl<TypeT,ClassDeclT,FieldT,MethodT> parent,
                        PropertySeed<TypeT,ClassDeclT,FieldT,MethodT> propertySeed)
Method Detail

getTypes

public List<? extends TypeRefImpl<TypeT,ClassDeclT>> getTypes()
Description copied from interface: ElementPropertyInfo
Returns the information about the types allowed in this property.

In a simple case like the following, an element property only has one TypeRef that points to String and 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.

Specified by:
getTypes in interface ElementPropertyInfo<TypeT,ClassDeclT>
Returns:
Always non-null. Contains at least one entry. If ElementPropertyInfo.isValueList()==true, there's always exactly one type.

createTypeRef

protected TypeRefImpl<TypeT,ClassDeclT> createTypeRef(QName name,
                                                      TypeT type,
                                                      boolean isNillable,
                                                      String defaultValue)
Used by PropertyInfoImpl to create new instances of TypeRef


isValueList

public boolean isValueList()
Description copied from interface: ElementPropertyInfo
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()==1 always holds.

Specified by:
isValueList in interface ElementPropertyInfo<TypeT,ClassDeclT>

isRequired

public boolean isRequired()
Description copied from interface: ElementPropertyInfo
Returns true if this element is mandatory. For collections, this property isn't used. TODO: define the semantics when this is a collection

Specified by:
isRequired in interface ElementPropertyInfo<TypeT,ClassDeclT>

ref

public List<? extends TypeInfo<TypeT,ClassDeclT>> ref()
Description copied from interface: PropertyInfo
List of TypeInfos that this property references. This allows the caller to traverse the reference graph without getting into the details of each different property type.

Specified by:
ref in interface PropertyInfo<TypeT,ClassDeclT>
Returns:
non-null read-only collection.

kind

public final PropertyKind kind()
Description copied from interface: PropertyInfo
Gets the kind of this proeprty.

Specified by:
kind in interface PropertyInfo<TypeT,ClassDeclT>
Returns:
always non-null.

link

protected void link()
Description copied from class: PropertyInfoImpl
Called after all the TypeInfos are collected into the governing TypeInfoSet. Derived class can do additional actions to complete the model.

Overrides:
link in class PropertyInfoImpl<TypeT,ClassDeclT,FieldT,MethodT>