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

pack-priv Class ElementInfoImpl<T, C, F, M>

extends TypeInfoImpl<T, C, F, M>
implements ElementInfo<T, C>
Class Inheritance
All Implemented Interfaces
org.glassfish.jaxb.core.v2.model.core.ElementInfo, org.glassfish.jaxb.core.v2.model.core.Element, org.glassfish.jaxb.core.v2.model.core.TypeInfo, org.glassfish.jaxb.core.v2.model.annotation.Locatable
Known Direct Subclasses
org.glassfish.jaxb.runtime.v2.model.impl.RuntimeElementInfoImpl
Imports
com.sun.istack.FinalArrayList, org.glassfish.jaxb.core.v2.TODO, org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource, .Locatable, org.glassfish.jaxb.core.v2.model.core.*, org.glassfish.jaxb.core.v2.runtime.IllegalAnnotationException, .Location, org.glassfish.jaxb.runtime.v2.runtime.SwaRefAdapter, jakarta.activation.MimeType, jakarta.xml.bind.JAXBElement, jakarta.xml.bind.annotation.*, jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter, javax.xml.namespace.QName, java.lang.annotation.Annotation, java.util.Collection, .Collections, .List

ElementInfo implementation.
Author
Kohsuke Kawaguchi

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class
ElementInfoImpl.PropertyImpl

Singleton instance of ElementPropertyInfo for this element.

Field Summary

Modifier and TypeField and Description
private final Adapter<T, C>
adapter

If the content type is adapter, return that adapter.

private final XmlElementDecl
anno

Annotation that controls the binding.

private final NonElement<T, C>
private final T
private final MimeType
private final ID
private final boolean
private final boolean
private final M
method

The factory method from which this mapping was created.

private final ElementInfoImpl<T, C, F, M>.PropertyImpl
private final QName
private final ClassInfo<T, C>
private ElementInfoImpl<T, C, F, M>
substitutionHead

If this element can substitute another element, the element name.

private FinalArrayList<ElementInfoImpl<T, C, F, M>>
substitutionMembers

Lazily constructed list of ElementInfos that can substitute this element.

private final QName
private final T
Inherited from org.glassfish.jaxb.runtime.v2.model.impl.TypeInfoImpl:
builderowner

Constructor Summary

AccessConstructor and Description
public
ElementInfoImpl(ModelBuilder<T, C, F, M> builder, RegistryInfoImpl<T, C, F, M> registry, M
The factory method on ObjectFactory that comes with XmlElementDecl.
m
)

Method Summary

Modifier and TypeMethod and Description
private void
private ID
public final boolean
canBeReferencedByIDREF()

Implements org.glassfish.jaxb.core.v2.model.core.TypeInfo.canBeReferencedByIDREF.

Deprecated why are you calling a method whose return value is always known?

Leaf-type cannot be referenced from IDREF.

protected ElementInfoImpl<T, C, F, M>.PropertyImpl
public T
public NonElement<T, C>
getContentType()

Implements org.glassfish.jaxb.core.v2.model.core.ElementInfo.getContentType.

Short for getProperty().ref().get(0).

public QName
getElementName()

Implements org.glassfish.jaxb.core.v2.model.core.Element.getElementName.

Gets the element name of the class.

public Location
getLocation()

Implements org.glassfish.jaxb.core.v2.model.annotation.Locatable.getLocation.

Gets the location object that this object points to.

public ElementPropertyInfo<T, C>
getProperty()

Implements org.glassfish.jaxb.core.v2.model.core.ElementInfo.getProperty.

Gets the object that represents the value property.

public ClassInfo<T, C>
getScope()

Implements org.glassfish.jaxb.core.v2.model.core.Element.getScope.

If non-null, this element is only active inside the given scope.

public ElementInfo<T, C>
getSubstitutionHead()

Implements org.glassfish.jaxb.core.v2.model.core.ElementInfo.getSubstitutionHead.

If this element can substitute another element, return that element.

public Collection<? extends ElementInfoImpl<T, C, F, M>>
public T
pack-priv final QName
parseElementName(XmlElementDecl e)

Overrides org.glassfish.jaxb.runtime.v2.model.impl.TypeInfoImpl.parseElementName.

Parses an XmlRootElement annotation on a class and determine the element name.

Inherited from org.glassfish.jaxb.runtime.v2.model.impl.TypeInfoImpl:
getUpstreamnavparseTypeNameparseTypeNamereader

Field Detail

adapterback to summary
private final Adapter<T, C> adapter

If the content type is adapter, return that adapter.

annoback to summary
private final XmlElementDecl anno

Annotation that controls the binding.

contentTypeback to summary
private final NonElement<T, C> contentType
elementTypeback to summary
private final T elementType
expectedMimeTypeback to summary
private final MimeType expectedMimeType
idback to summary
private final ID id
inlineBinaryback to summary
private final boolean inlineBinary
isCollectionback to summary
private final boolean isCollection
methodback to summary
private final M method

The factory method from which this mapping was created.

propertyback to summary
private final ElementInfoImpl<T, C, F, M>.PropertyImpl property
schemaTypeback to summary
private final QName schemaType
scopeback to summary
private final ClassInfo<T, C> scope
substitutionHeadback to summary
private ElementInfoImpl<T, C, F, M> substitutionHead

If this element can substitute another element, the element name.

See Also
link()
substitutionMembersback to summary
private FinalArrayList<ElementInfoImpl<T, C, F, M>> substitutionMembers

Lazily constructed list of ElementInfos that can substitute this element. This could be null.

See Also
link()
tagNameback to summary
private final QName tagName
tOfJAXBElementTback to summary
private final T tOfJAXBElementT

Constructor Detail

ElementInfoImplback to summary
public ElementInfoImpl(ModelBuilder<T, C, F, M> builder, RegistryInfoImpl<T, C, F, M> registry, M m) throws IllegalAnnotationException
Parameters
m:M

The factory method on ObjectFactory that comes with XmlElementDecl.

Method Detail

addSubstitutionMemberback to summary
private void addSubstitutionMember(ElementInfoImpl<T, C, F, M> child)
calcIdback to summary
private ID calcId()
canBeReferencedByIDREFback to summary
public final boolean canBeReferencedByIDREF()

Implements org.glassfish.jaxb.core.v2.model.core.TypeInfo.canBeReferencedByIDREF.

Deprecated

why are you calling a method whose return value is always known?

Leaf-type cannot be referenced from IDREF.

Annotations
@Override
@Deprecated
createPropertyImplback to summary
protected ElementInfoImpl<T, C, F, M>.PropertyImpl createPropertyImpl()
getContentInMemoryTypeback to summary
public T getContentInMemoryType()

Implements org.glassfish.jaxb.core.v2.model.core.ElementInfo.getContentInMemoryType.

Doc from org.glassfish.jaxb.core.v2.model.core.ElementInfo.getContentInMemoryType.

T of JAXBElement<T>.

This is tied to the in-memory representation.

Annotations
@Override
getContentTypeback to summary
public NonElement<T, C> getContentType()

Implements org.glassfish.jaxb.core.v2.model.core.ElementInfo.getContentType.

Doc from org.glassfish.jaxb.core.v2.model.core.ElementInfo.getContentType.

Short for getProperty().ref().get(0). The type of the value this element holds. Normally, this is the T of JAXBElement<T>. But if the property is adapted, this is the on-the-wire type. Or if the element has a list of values, then this field represents the type of the individual item.

Annotations
@Override
getElementNameback to summary
public QName getElementName()

Implements org.glassfish.jaxb.core.v2.model.core.Element.getElementName.

Doc from org.glassfish.jaxb.core.v2.model.core.Element.getElementName.

Gets the element name of the class.

Annotations
@Override
getLocationback to summary
public Location getLocation()

Implements org.glassfish.jaxb.core.v2.model.annotation.Locatable.getLocation.

Doc from org.glassfish.jaxb.core.v2.model.annotation.Locatable.getLocation.

Gets the location object that this object points to. This operation could be inefficient and costly.

Annotations
@Override
getPropertyback to summary
public ElementPropertyInfo<T, C> getProperty()

Implements org.glassfish.jaxb.core.v2.model.core.ElementInfo.getProperty.

Doc from org.glassfish.jaxb.core.v2.model.core.ElementInfo.getProperty.

Gets the object that represents the value property.

Annotations
@Override
getScopeback to summary
public ClassInfo<T, C> getScope()

Implements org.glassfish.jaxb.core.v2.model.core.Element.getScope.

Doc from org.glassfish.jaxb.core.v2.model.core.Element.getScope.

If non-null, this element is only active inside the given scope.

Annotations
@Override
getSubstitutionHeadback to summary
public ElementInfo<T, C> getSubstitutionHead()

Implements org.glassfish.jaxb.core.v2.model.core.ElementInfo.getSubstitutionHead.

Doc from org.glassfish.jaxb.core.v2.model.core.ElementInfo.getSubstitutionHead.

If this element can substitute another element, return that element.

Substitutability of elements are transitive. can only substitute .

Annotations
@Override
getSubstitutionMembersback to summary
public Collection<? extends ElementInfoImpl<T, C, F, M>> getSubstitutionMembers()

Implements org.glassfish.jaxb.core.v2.model.core.ElementInfo.getSubstitutionMembers.

Doc from org.glassfish.jaxb.core.v2.model.core.ElementInfo.getSubstitutionMembers.

All the s whose getSubstitutionHead() points to this object.

Annotations
@Override
getTypeback to summary
public T getType()

Implements org.glassfish.jaxb.core.v2.model.core.ElementInfo.getType, org.glassfish.jaxb.core.v2.model.core.TypeInfo.getType.

Doc from org.glassfish.jaxb.core.v2.model.core.ElementInfo.getType.

Returns the representation for JAXBElement<contentInMemoryType>.

This returns the signature in Java and thus isn't affected by the adapter.

Annotations
@Override
parseElementNameback to summary
pack-priv final QName parseElementName(XmlElementDecl e)

Overrides org.glassfish.jaxb.runtime.v2.model.impl.TypeInfoImpl.parseElementName.

Doc from org.glassfish.jaxb.runtime.v2.model.impl.TypeInfoImpl.parseElementName.

Parses an XmlRootElement annotation on a class and determine the element name.

org.glassfish.jaxb.runtime.v2.model.impl back to summary

protected Class ElementInfoImpl.PropertyImpl

extends Object
implements ElementPropertyInfo<T, C>, TypeRef<T, C>, AnnotationSource
Class Inheritance
  • java.lang.Object
  • org.glassfish.jaxb.runtime.v2.model.impl.ElementInfoImpl.PropertyImpl
All Implemented Interfaces
org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource, org.glassfish.jaxb.core.v2.model.core.TypeRef, org.glassfish.jaxb.core.v2.model.core.NonElementRef, org.glassfish.jaxb.core.v2.model.core.ElementPropertyInfo, org.glassfish.jaxb.core.v2.model.core.PropertyInfo
Known Direct Subclasses
org.glassfish.jaxb.runtime.v2.model.impl.RuntimeElementInfoImpl.RuntimePropertyImpl

Singleton instance of ElementPropertyInfo for this element.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public String
displayName()

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

Gets the display name of the property.

public Adapter<T, C>
public String
getDefaultValue()

Implements org.glassfish.jaxb.core.v2.model.core.TypeRef.getDefaultValue.

The default value for this element if any.

public MimeType
public String
getName()

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

Gets the name of the property.

public QName
public PropertyInfo<T, C>
getSource()

Implements org.glassfish.jaxb.core.v2.model.core.NonElementRef.getSource.

Gets the property which is the source of this reference.

public QName
getTagName()

Implements org.glassfish.jaxb.core.v2.model.core.TypeRef.getTagName.

The associated element name.

public NonElement<T, C>
public List<? extends TypeRef<T, C>>
getTypes()

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

Returns the information about the types allowed in this property.

public QName
public boolean
hasAnnotation(Class<? extends Annotation> annotationType)

Implements org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource.hasAnnotation.

Returns true if the property has the specified annotation.

public ID
id()

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

Returns the IDness of the value of this element.

public boolean
inlineBinaryData()

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

If this is true and this property indeed represents a binary data, it should be always inlined.

public boolean
isCollection()

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

Returns true if this is a multi-valued collection property.

public boolean
isCollectionNillable()

Implements org.glassfish.jaxb.core.v2.model.core.ElementPropertyInfo.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.

public boolean
public boolean
isNillable()

Implements org.glassfish.jaxb.core.v2.model.core.TypeRef.isNillable.

Returns true if this element is nillable.

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.

For ElementInfos, a collection always means a list of values.

public PropertyKind
kind()

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

Gets the kind of this property.

public ElementInfoImpl<T, C, F, M>
parent()

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

Gets the ClassInfo or ElementInfo to which this property belongs.

public <A extends Annotation> A
readAnnotation(Class<A> annotationType)

Implements org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource.readAnnotation.

Gets the value of the specified annotation from the given property.

public List<? extends NonElement<T, C>>
ref()

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

List of TypeInfos that this property references.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PropertyImplback to summary
protected PropertyImpl()

Method Detail

displayNameback to summary
public String displayName()

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

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

Gets the display name of the property.

This is a convenience method for parent().getName()+'#'+getName().

Annotations
@Override
getAdapterback to summary
public Adapter<T, C> getAdapter()

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

Annotations
@Override
getDefaultValueback to summary
public String getDefaultValue()

Implements org.glassfish.jaxb.core.v2.model.core.TypeRef.getDefaultValue.

Doc from org.glassfish.jaxb.core.v2.model.core.TypeRef.getDefaultValue.

The default value for this element if any. Otherwise null.

Annotations
@Override
getExpectedMimeTypeback to summary
public MimeType getExpectedMimeType()

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

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

Expected MIME type, if any.

Annotations
@Override
getNameback to summary
public String getName()

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

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

Gets the name of the property.

For example, "foo" or "bar". Generally, a property name is different from XML, (although they are often related, as a property name is often computed from tag names / attribute names.) In fact, property names do not directly affect XML. The property name uniquely identifies a property within a class.

Annotations
@Override
getSchemaTypeback to summary
public QName getSchemaType()

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

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

The effective value of XmlSchemaType annotation, if any.

If the property doesn't have XmlSchemaType annotation, this method returns null.

Since a type name is a property of a Java type, not a Java property, A schema type name of a Java type should be primarily obtained by using NonElement#getTypeName(). This method is to correctly implement the ugly semantics of XmlSchemaType (namely when this returns non-null, it overrides the type names of all types that are in this property.)

Annotations
@Override
getSourceback to summary
public PropertyInfo<T, C> getSource()

Implements org.glassfish.jaxb.core.v2.model.core.NonElementRef.getSource.

Doc from org.glassfish.jaxb.core.v2.model.core.NonElementRef.getSource.

Gets the property which is the source of this reference.

Annotations
@Override
getTagNameback to summary
public QName getTagName()

Implements org.glassfish.jaxb.core.v2.model.core.TypeRef.getTagName.

Doc from org.glassfish.jaxb.core.v2.model.core.TypeRef.getTagName.

The associated element name.

Annotations
@Override
getTargetback to summary
public NonElement<T, C> getTarget()

Implements org.glassfish.jaxb.core.v2.model.core.NonElementRef.getTarget.

Doc from org.glassfish.jaxb.core.v2.model.core.NonElementRef.getTarget.

Target of the reference.

Annotations
@Override
getTypesback to summary
public List<? extends TypeRef<T, C>> 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
getXmlNameback to summary
public QName getXmlName()

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

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

Gets the wrapper element name.

Annotations
@Override
hasAnnotationback to summary
public boolean hasAnnotation(Class<? extends Annotation> annotationType)

Implements org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource.hasAnnotation.

Doc from org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource.hasAnnotation.

Returns true if the property has the specified annotation.

Short for readAnnotation(annotationType)!=null, but this method is typically faster.

Annotations
@Override
idback to summary
public ID id()

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

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

Returns the IDness of the value of this element.

Annotations
@Override
inlineBinaryDataback to summary
public boolean inlineBinaryData()

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

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

If this is true and this property indeed represents a binary data, it should be always inlined.

Annotations
@Override
isCollectionback to summary
public boolean isCollection()

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

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

Returns true if this is a multi-valued collection property. Otherwise false, in which case the property is a single value.

Annotations
@Override
isCollectionNillableback to summary
public boolean isCollectionNillable()

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

Doc from org.glassfish.jaxb.core.v2.model.core.ElementPropertyInfo.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.

Annotations
@Override
isCollectionRequiredback to summary
public boolean isCollectionRequired()

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

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

Checks if the wrapper element is required.

Annotations
@Override
isNillableback to summary
public boolean isNillable()

Implements org.glassfish.jaxb.core.v2.model.core.TypeRef.isNillable.

Doc from org.glassfish.jaxb.core.v2.model.core.TypeRef.isNillable.

Returns true if this element is nillable.

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.

For ElementInfos, a collection always means a list of values.

Annotations
@Override
kindback to summary
public 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
parentback to summary
public ElementInfoImpl<T, C, F, M> parent()

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

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

Gets the ClassInfo or ElementInfo to which this property belongs.

Annotations
@Override
readAnnotationback to summary
public <A extends Annotation> A readAnnotation(Class<A> annotationType)

Implements org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource.readAnnotation.

Doc from org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource.readAnnotation.

Gets the value of the specified annotation from the given property.

When this method is used for a property that consists of a getter and setter, it returns the annotation on either of those methods. If both methods have the same annotation, it is an error.

Annotations
@Override
refback to summary
public List<? extends NonElement<T, C>> 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