- java.lang.Object
-
- com.sun.tools.xjc.model.CPropertyInfo
-
- com.sun.tools.xjc.model.CElementPropertyInfo
-
- All Implemented Interfaces:
CCustomizable,AnnotationSource,ElementPropertyInfo<NType,NClass>,PropertyInfo<NType,NClass>
public final class CElementPropertyInfo extends CPropertyInfo implements ElementPropertyInfo<NType,NClass>
ElementPropertyInfofor the compiler.- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCElementPropertyInfo.CollectionMode
-
Field Summary
-
Fields inherited from class com.sun.tools.xjc.model.CPropertyInfo
baseType, defaultValue, inlineBinaryData, javadoc, locator, realization
-
-
Constructor Summary
Constructors Constructor Description CElementPropertyInfo(String name, CElementPropertyInfo.CollectionMode collection, ID id, jakarta.activation.MimeType expectedMimeType, XSComponent source, CCustomizations customizations, Locator locator, boolean required)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <V> Vaccept(CPropertyVisitor<V> visitor)<R,P>
Raccept(CPropertyVisitor2<R,P> visitor, P p)QNamecollectElementNames(Map<QName,CPropertyInfo> table)Puts the element names that this property possesses to the map, so that we can find two properties that own the same element name, which is an error.CAdaptergetAdapter()jakarta.activation.MimeTypegetExpectedMimeType()Expected MIME type, if any.QNamegetSchemaType()The effective value ofXmlSchemaTypeannotation, if any.List<CTypeRef>getTypes()Returns the information about the types allowed in this property.QNamegetXmlName()Deprecated.IDid()Returns the IDness of the value of this element.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.booleanisOptionalPrimitive()Returns true if this property needs to represent null just for the purpose of representing an absence of the property.booleanisRequired()Returns true if this element is mandatory.booleanisUnboxable()Returns true if this property is "unboxable".booleanisValueList()Returns true if this property is a collection but its XML representation is a list of values, not repeated elements.PropertyKindkind()Gets the kind of this property.List<CNonElement>ref()List ofTypeInfos that this property references.voidsetAdapter(CAdapter a)-
Methods inherited from class com.sun.tools.xjc.model.CPropertyInfo
displayName, getCustomizations, getLocator, getName, getName, getSchemaComponent, hasAnnotation, inlineBinaryData, isCollection, needsExplicitTypeName, parent, readAnnotation, setName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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, getName, inlineBinaryData, isCollection, parent
-
-
-
-
Constructor Detail
-
CElementPropertyInfo
public CElementPropertyInfo(String name, CElementPropertyInfo.CollectionMode collection, ID id, jakarta.activation.MimeType expectedMimeType, XSComponent source, CCustomizations customizations, Locator locator, boolean required)
-
-
Method Detail
-
id
public ID id()
Description copied from interface:PropertyInfoReturns the IDness of the value of this element.- Specified by:
idin interfacePropertyInfo<NType,NClass>- Returns:
- always non-null
- See Also:
XmlID,XmlIDREF
-
getTypes
public List<CTypeRef> getTypes()
Description copied from interface:ElementPropertyInfoReturns 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.- Specified by:
getTypesin interfaceElementPropertyInfo<NType,NClass>- Returns:
- Always non-null. Contains at least one entry.
If
ElementPropertyInfo.isValueList()==true, there's always exactly one type.
-
ref
public List<CNonElement> ref()
Description copied from interface:PropertyInfoList ofTypeInfos 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:
refin interfacePropertyInfo<NType,NClass>- Specified by:
refin classCPropertyInfo- Returns:
- non-null read-only collection.
-
getSchemaType
public QName getSchemaType()
Description copied from interface:PropertyInfoThe effective value ofXmlSchemaTypeannotation, if any.If the property doesn't have
XmlSchemaTypeannotation, 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 ofXmlSchemaType(namely when this returns non-null, it overrides the type names of all types that are in this property.)- Specified by:
getSchemaTypein interfacePropertyInfo<NType,NClass>
-
getXmlName
@Deprecated public QName getXmlName()
Deprecated.XJC never uses the wrapper element. Always return null.- Specified by:
getXmlNamein interfaceElementPropertyInfo<NType,NClass>- Returns:
- must be null if
PropertyInfo.isCollection()==false or ifElementPropertyInfo.isValueList()==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
public boolean isCollectionRequired()
Description copied from interface:ElementPropertyInfoChecks if the wrapper element is required.- Specified by:
isCollectionRequiredin interfaceElementPropertyInfo<NType,NClass>- Returns:
- Always false if
ElementPropertyInfo.getXmlName()==null.
-
isCollectionNillable
public boolean isCollectionNillable()
Description copied from interface:ElementPropertyInfoReturns 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.
- Specified by:
isCollectionNillablein interfaceElementPropertyInfo<NType,NClass>
-
isRequired
public boolean isRequired()
Description copied from interface:ElementPropertyInfoReturns true if this element is mandatory. For collections, this property isn't used. TODO: define the semantics when this is a collection- Specified by:
isRequiredin interfaceElementPropertyInfo<NType,NClass>
-
isValueList
public boolean isValueList()
Description copied from interface:ElementPropertyInfoReturns 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.- Specified by:
isValueListin interfaceElementPropertyInfo<NType,NClass>
-
isUnboxable
public boolean isUnboxable()
Description copied from class:CPropertyInfoReturns true if this property is "unboxable".In general, a property often has to be capable of representing null to indicate the absence of the value. This requires properties to be generated as
@XmlElement Float f, not as@XmlElement float f;. But this is slow.Fortunately, there are cases where we know that the property can never legally be absent. When this condition holds we can generate the optimized "unboxed form".
The exact such conditions depend on the kind of properties, so refer to the implementation code for the details.
This method returns true when the property can be generated as "unboxed form", false otherwise.
When this property is a collection, this method returns true if items in the collection is unboxable. Obviously, the collection itself is always a reference type.
- Overrides:
isUnboxablein classCPropertyInfo
-
isOptionalPrimitive
public boolean isOptionalPrimitive()
Description copied from class:CPropertyInfoReturns true if this property needs to represent null just for the purpose of representing an absence of the property.- Overrides:
isOptionalPrimitivein classCPropertyInfo
-
accept
public <V> V accept(CPropertyVisitor<V> visitor)
- Specified by:
acceptin classCPropertyInfo
-
accept
public <R,P> R accept(CPropertyVisitor2<R,P> visitor, P p)
- Specified by:
acceptin classCPropertyInfo
-
getAdapter
public CAdapter getAdapter()
- Specified by:
getAdapterin interfaceElementPropertyInfo<NType,NClass>- Specified by:
getAdapterin interfacePropertyInfo<NType,NClass>- Specified by:
getAdapterin classCPropertyInfo- Returns:
- null if the property is not adapted.
-
setAdapter
public void setAdapter(CAdapter a)
-
kind
public final PropertyKind kind()
Description copied from interface:PropertyInfoGets the kind of this property.- Specified by:
kindin interfacePropertyInfo<NType,NClass>- Returns:
- always non-null.
-
getExpectedMimeType
public jakarta.activation.MimeType getExpectedMimeType()
Description copied from interface:PropertyInfoExpected MIME type, if any.- Specified by:
getExpectedMimeTypein interfacePropertyInfo<NType,NClass>
-
collectElementNames
public QName collectElementNames(Map<QName,CPropertyInfo> table)
Description copied from class:CPropertyInfoPuts the element names that this property possesses to the map, so that we can find two properties that own the same element name, which is an error.- Overrides:
collectElementNamesin classCPropertyInfo- Returns:
- null if no conflict was found. Otherwise return the QName that has the collision.
-
-