Top Description Fields Constructors Methods
org.glassfish.jaxb.runtime.v2.model.impl

pack-priv Class ElementPropertyInfoImpl<TypeT, ClassDeclT, FieldT, MethodT>

extends ERPropertyInfoImpl<TypeT, ClassDeclT, FieldT, MethodT>
implements ElementPropertyInfo<TypeT, ClassDeclT>
Class Inheritance
All Implemented Interfaces
org.glassfish.jaxb.core.v2.model.core.ElementPropertyInfo, org.glassfish.jaxb.core.v2.model.core.PropertyInfo, org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource
Known Direct Subclasses
org.glassfish.jaxb.runtime.v2.model.impl.RuntimeElementPropertyInfoImpl
Imports
com.sun.istack.FinalArrayList, org.glassfish.jaxb.core.v2.model.core.*, org.glassfish.jaxb.core.v2.runtime.IllegalAnnotationException, jakarta.xml.bind.annotation.XmlElement, .XmlElements, .XmlList, javax.xml.namespace.QName, java.util.AbstractList, .Collections, .List

Common ElementPropertyInfo implementation used for both Annotation Processing and runtime.
Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
private Boolean
isRequired

Lazily computed.

private final boolean
private final List<TypeInfo<TypeT, ClassDeclT>>
private List<TypeRefImpl<TypeT, ClassDeclT>>
types

Lazily computed.

Constructor Summary

AccessConstructor and Description
pack-priv
ElementPropertyInfoImpl(ClassInfoImpl<TypeT, ClassDeclT, FieldT, MethodT> parent, PropertySeed<TypeT, ClassDeclT, FieldT, MethodT> propertySeed)

Method Summary

Modifier and TypeMethod and Description
protected TypeRefImpl<TypeT, ClassDeclT>
createTypeRef(QName name, TypeT type, boolean isNillable, String defaultValue)

Used by PropertyInfoImpl to create new instances of TypeRef

private String
public List<? extends TypeRefImpl<TypeT, ClassDeclT>>
getTypes()

Implements org.glassfish.jaxb.core.v2.model.core.ElementPropertyInfo.getTypes.

Returns the information about the types allowed in this property.

public boolean
isRequired()

Implements org.glassfish.jaxb.core.v2.model.core.ElementPropertyInfo.isRequired.

Returns true if this element is mandatory.

public boolean
isValueList()

Implements org.glassfish.jaxb.core.v2.model.core.ElementPropertyInfo.isValueList.

Returns true if this property is a collection but its XML representation is a list of values, not repeated elements.

public final PropertyKind
kind()

Implements org.glassfish.jaxb.core.v2.model.core.PropertyInfo.kind.

Gets the kind of this property.

public List<? extends TypeInfo<TypeT, ClassDeclT>>
ref()

Implements org.glassfish.jaxb.core.v2.model.core.PropertyInfo.ref.

List of TypeInfos that this property references.

Inherited from org.glassfish.jaxb.runtime.v2.model.impl.ERPropertyInfoImpl:
getXmlNameisCollectionNillableisCollectionRequired

Field Detail

isRequiredback to summary
private Boolean isRequired

Lazily computed.

See Also
isRequired()
isValueListback to summary
private final boolean isValueList
See Also
isValueList()
refback to summary
private final List<TypeInfo<TypeT, ClassDeclT>> ref
typesback to summary
private List<TypeRefImpl<TypeT, ClassDeclT>> types

Lazily computed.

See Also
getTypes()

Constructor Detail

ElementPropertyInfoImplback to summary
pack-priv ElementPropertyInfoImpl(ClassInfoImpl<TypeT, ClassDeclT, FieldT, MethodT> parent, PropertySeed<TypeT, ClassDeclT, FieldT, MethodT> propertySeed)

Method Detail

createTypeRefback to summary
protected TypeRefImpl<TypeT, ClassDeclT> createTypeRef(QName name, TypeT type, boolean isNillable, String defaultValue)

Used by PropertyInfoImpl to create new instances of TypeRef

getDefaultValueback to summary
private String getDefaultValue(String value)
getTypesback to summary
public List<? extends TypeRefImpl<TypeT, ClassDeclT>> getTypes()

Implements org.glassfish.jaxb.core.v2.model.core.ElementPropertyInfo.getTypes.

Doc from org.glassfish.jaxb.core.v2.model.core.ElementPropertyInfo.getTypes.

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.

Annotations
@Override
isRequiredback to summary
public boolean isRequired()

Implements org.glassfish.jaxb.core.v2.model.core.ElementPropertyInfo.isRequired.

Doc from org.glassfish.jaxb.core.v2.model.core.ElementPropertyInfo.isRequired.

Returns true if this element is mandatory. For collections, this property isn't used.

Todo

define the semantics when this is a collection

Annotations
@Override
isValueListback to summary
public boolean isValueList()

Implements org.glassfish.jaxb.core.v2.model.core.ElementPropertyInfo.isValueList.

Doc from org.glassfish.jaxb.core.v2.model.core.ElementPropertyInfo.isValueList.

Returns true if this property is a collection but its XML representation is a list of values, not repeated elements.

If isCollection()==false, this property is always false.

When this flag is true, getTypes().size()==1 always holds.

Annotations
@Override
kindback to summary
public final PropertyKind kind()

Implements org.glassfish.jaxb.core.v2.model.core.PropertyInfo.kind.

Doc from org.glassfish.jaxb.core.v2.model.core.PropertyInfo.kind.

Gets the kind of this property.

Annotations
@Override
refback to summary
public List<? extends TypeInfo<TypeT, ClassDeclT>> ref()

Implements org.glassfish.jaxb.core.v2.model.core.PropertyInfo.ref.

Doc from org.glassfish.jaxb.core.v2.model.core.PropertyInfo.ref.

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.

Annotations
@Override