public final class CElementPropertyInfo extends CPropertyInfo implements ElementPropertyInfo<NType,NClass>
ElementPropertyInfo
for the compiler.Modifier and Type | Class and Description |
---|---|
static class |
CElementPropertyInfo.CollectionMode |
baseType, defaultValue, inlineBinaryData, javadoc, locator, realization
Constructor and Description |
---|
CElementPropertyInfo(String name,
CElementPropertyInfo.CollectionMode collection,
ID id,
MimeType expectedMimeType,
com.sun.xml.xsom.XSComponent source,
CCustomizations customizations,
Locator locator,
boolean required) |
Modifier and Type | Method and Description |
---|---|
<V> V |
accept(CPropertyVisitor<V> visitor) |
<R,P> R |
accept(CPropertyVisitor2<R,P> visitor,
P p) |
QName |
collectElementNames(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.
|
CAdapter |
getAdapter() |
MimeType |
getExpectedMimeType()
Expected MIME type, if any.
|
QName |
getSchemaType()
The effective value of
XmlSchemaType annotation, if any. |
List<CTypeRef> |
getTypes()
Returns the information about the types allowed in this property.
|
QName |
getXmlName()
Deprecated.
|
ID |
id()
Returns the IDness of the value of this element.
|
boolean |
isCollectionNillable()
Returns true if this property is nillable
(meaning the absence of the value is treated as nil='true')
|
boolean |
isCollectionRequired()
Checks if the wrapper element is required.
|
boolean |
isOptionalPrimitive()
Returns true if this property needs to represent null
just for the purpose of representing an absence of the property.
|
boolean |
isRequired()
Returns true if this element is mandatory.
|
boolean |
isUnboxable()
Returns true if this property is "unboxable".
|
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 property.
|
List<CNonElement> |
ref()
List of
TypeInfo s that this property references. |
void |
setAdapter(CAdapter a) |
displayName, getCustomizations, getLocator, getName, getName, getSchemaComponent, hasAnnotation, inlineBinaryData, isCollection, needsExplicitTypeName, parent, readAnnotation, setName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
displayName, getName, inlineBinaryData, isCollection, parent
hasAnnotation, readAnnotation
public CElementPropertyInfo(String name, CElementPropertyInfo.CollectionMode collection, ID id, MimeType expectedMimeType, com.sun.xml.xsom.XSComponent source, CCustomizations customizations, Locator locator, boolean required)
public ID id()
PropertyInfo
public List<CTypeRef> getTypes()
ElementPropertyInfo
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 TypeRef
s.
getTypes
in interface ElementPropertyInfo<NType,NClass>
ElementPropertyInfo.isValueList()
==true, there's always exactly one type.public List<CNonElement> ref()
PropertyInfo
TypeInfo
s that this property references.
This allows the caller to traverse the reference graph without
getting into the details of each different property type.ref
in interface PropertyInfo<NType,NClass>
ref
in class CPropertyInfo
public QName getSchemaType()
PropertyInfo
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.)
getSchemaType
in interface PropertyInfo<NType,NClass>
@Deprecated public QName getXmlName()
getXmlName
in interface ElementPropertyInfo<NType,NClass>
PropertyInfo.isCollection()
==false or
if ElementPropertyInfo.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)public boolean isCollectionRequired()
ElementPropertyInfo
isCollectionRequired
in interface ElementPropertyInfo<NType,NClass>
ElementPropertyInfo.getXmlName()
==null.public boolean isCollectionNillable()
ElementPropertyInfo
This method is only used when this property is a collection.
isCollectionNillable
in interface ElementPropertyInfo<NType,NClass>
public boolean isRequired()
ElementPropertyInfo
isRequired
in interface ElementPropertyInfo<NType,NClass>
public boolean isValueList()
ElementPropertyInfo
If PropertyInfo.isCollection()
==false, this property is always false.
When this flag is true, getTypes().size()==1
always holds.
isValueList
in interface ElementPropertyInfo<NType,NClass>
public boolean isUnboxable()
CPropertyInfo
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.
isUnboxable
in class CPropertyInfo
public boolean isOptionalPrimitive()
CPropertyInfo
isOptionalPrimitive
in class CPropertyInfo
public <V> V accept(CPropertyVisitor<V> visitor)
accept
in class CPropertyInfo
public <R,P> R accept(CPropertyVisitor2<R,P> visitor, P p)
accept
in class CPropertyInfo
public CAdapter getAdapter()
getAdapter
in interface ElementPropertyInfo<NType,NClass>
getAdapter
in interface PropertyInfo<NType,NClass>
getAdapter
in class CPropertyInfo
public void setAdapter(CAdapter a)
public final PropertyKind kind()
PropertyInfo
kind
in interface PropertyInfo<NType,NClass>
public MimeType getExpectedMimeType()
PropertyInfo
getExpectedMimeType
in interface PropertyInfo<NType,NClass>
public QName collectElementNames(Map<QName,CPropertyInfo> table)
CPropertyInfo
collectElementNames
in class CPropertyInfo
Copyright © 2019 JBoss by Red Hat. All rights reserved.