Class CReferencePropertyInfo
- java.lang.Object
-
- com.sun.tools.xjc.model.CPropertyInfo
-
- com.sun.tools.xjc.model.CReferencePropertyInfo
-
- All Implemented Interfaces:
CCustomizable
,AnnotationSource
,PropertyInfo<NType,NClass>
,ReferencePropertyInfo<NType,NClass>
public final class CReferencePropertyInfo extends CPropertyInfo implements ReferencePropertyInfo<NType,NClass>
ReferencePropertyInfo
for the compiler.- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
-
Fields inherited from class com.sun.tools.xjc.model.CPropertyInfo
baseType, defaultValue, inlineBinaryData, javadoc, locator, realization
-
-
Constructor Summary
Constructors Constructor Description CReferencePropertyInfo(java.lang.String name, boolean collection, boolean required, boolean isMixed, XSComponent source, CCustomizations customizations, org.xml.sax.Locator locator, boolean dummy, boolean content, boolean isMixedExtended)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <V> V
accept(CPropertyVisitor<V> visitor)
<R,P>
Raccept(CPropertyVisitor2<R,P> visitor, P p)
javax.xml.namespace.QName
collectElementNames(java.util.Map<javax.xml.namespace.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()
NClass
getDOMHandler()
If this property supports the wildcard, returns its DOM handler.java.util.Set<CElement>
getElements()
Returns the information about the possible elements in this property.javax.activation.MimeType
getExpectedMimeType()
Expected MIME type, if any.javax.xml.namespace.QName
getSchemaType()
The effective value ofXmlSchemaType
annotation, if any.WildcardMode
getWildcard()
If this property supports the wildcard, returns its mode.javax.xml.namespace.QName
getXmlName()
Deprecated.ID
id()
A reference property can never be ID/IDREF because they always point to other element classes.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
isContent()
boolean
isDummy()
boolean
isMixed()
Returns true if this property can holdString
s to represent mixed content model.boolean
isMixedExtendedCust()
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()
Reference properties refer to elements, and none of the Java primitive type maps to an element.PropertyKind
kind()
Gets the kind of this property.java.util.Set<? extends CTypeInfo>
ref()
List ofTypeInfo
s that this property references.void
setWildcard(WildcardMode mode)
-
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 com.sun.xml.bind.v2.model.annotation.AnnotationSource
hasAnnotation, readAnnotation
-
Methods inherited from interface com.sun.xml.bind.v2.model.core.PropertyInfo
displayName, getName, inlineBinaryData, isCollection, parent
-
-
-
-
Constructor Detail
-
CReferencePropertyInfo
public CReferencePropertyInfo(java.lang.String name, boolean collection, boolean required, boolean isMixed, XSComponent source, CCustomizations customizations, org.xml.sax.Locator locator, boolean dummy, boolean content, boolean isMixedExtended)
-
-
Method Detail
-
ref
public java.util.Set<? extends CTypeInfo> ref()
Description copied from interface:PropertyInfo
List ofTypeInfo
s 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 interfacePropertyInfo<NType,NClass>
- Specified by:
ref
in interfaceReferencePropertyInfo<NType,NClass>
- Specified by:
ref
in classCPropertyInfo
- Returns:
- non-null read-only collection.
-
getElements
public java.util.Set<CElement> getElements()
Description copied from interface:ReferencePropertyInfo
Returns the information about the possible elements in this property.As of 2004/08/17, the spec only allows you to use different element names when a property is a collection, but I think there's really no reason to limit it there --- if the user wants to use a different tag name for different objects, I don't see why this can be limited to collections.
So this is a generalization of the spec. We always allow a property to have multiple types and use different tag names for it, depending on the actual type.
In most of the cases, this collection only contains 1 item. So the runtime system is encouraged to provide a faster code-path that is optimized toward such cases.
- Specified by:
getElements
in interfaceReferencePropertyInfo<NType,NClass>
- Returns:
- Always non-null. Contains at least one entry.
-
isMixed
public boolean isMixed()
Description copied from interface:ReferencePropertyInfo
Returns true if this property can holdString
s to represent mixed content model.- Specified by:
isMixed
in interfaceReferencePropertyInfo<NType,NClass>
-
isDummy
public boolean isDummy()
-
isContent
public boolean isContent()
-
isMixedExtendedCust
public boolean isMixedExtendedCust()
-
getXmlName
@Deprecated public javax.xml.namespace.QName getXmlName()
Deprecated.We'll never use a wrapper element in XJC. Always return null.- Specified by:
getXmlName
in interfaceReferencePropertyInfo<NType,NClass>
- Returns:
- must be null if not collection. If the property is a collection, 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)
-
isUnboxable
public boolean isUnboxable()
Reference properties refer to elements, and none of the Java primitive type maps to an element. Thus a reference property is always unboxable.- Overrides:
isUnboxable
in classCPropertyInfo
-
isOptionalPrimitive
public boolean isOptionalPrimitive()
Description copied from class:CPropertyInfo
Returns true if this property needs to represent null just for the purpose of representing an absence of the property.- Overrides:
isOptionalPrimitive
in classCPropertyInfo
-
accept
public <V> V accept(CPropertyVisitor<V> visitor)
- Specified by:
accept
in classCPropertyInfo
-
accept
public <R,P> R accept(CPropertyVisitor2<R,P> visitor, P p)
- Specified by:
accept
in classCPropertyInfo
-
getAdapter
public CAdapter getAdapter()
- Specified by:
getAdapter
in interfacePropertyInfo<NType,NClass>
- Specified by:
getAdapter
in interfaceReferencePropertyInfo<NType,NClass>
- Specified by:
getAdapter
in classCPropertyInfo
- Returns:
- null if the property is not adapted.
-
kind
public final PropertyKind kind()
Description copied from interface:PropertyInfo
Gets the kind of this property.- Specified by:
kind
in interfacePropertyInfo<NType,NClass>
- Returns:
- always non-null.
-
id
public ID id()
A reference property can never be ID/IDREF because they always point to other element classes.- Specified by:
id
in interfacePropertyInfo<NType,NClass>
- Returns:
- always non-null
- See Also:
XmlID
,XmlIDREF
-
getWildcard
public WildcardMode getWildcard()
Description copied from interface:ReferencePropertyInfo
If this property supports the wildcard, returns its mode.- Specified by:
getWildcard
in interfaceReferencePropertyInfo<NType,NClass>
- Returns:
- null if the wildcard is not allowed on this element.
-
setWildcard
public void setWildcard(WildcardMode mode)
-
getDOMHandler
public NClass getDOMHandler()
Description copied from interface:ReferencePropertyInfo
If this property supports the wildcard, returns its DOM handler.- Specified by:
getDOMHandler
in interfaceReferencePropertyInfo<NType,NClass>
- Returns:
- null if the wildcard is not allowed on this element.
-
getExpectedMimeType
public javax.activation.MimeType getExpectedMimeType()
Description copied from interface:PropertyInfo
Expected MIME type, if any.- Specified by:
getExpectedMimeType
in interfacePropertyInfo<NType,NClass>
-
isCollectionNillable
public boolean isCollectionNillable()
Description copied from interface:ReferencePropertyInfo
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.
- Specified by:
isCollectionNillable
in interfaceReferencePropertyInfo<NType,NClass>
-
isCollectionRequired
public boolean isCollectionRequired()
Description copied from interface:ReferencePropertyInfo
Checks if the wrapper element is required.- Specified by:
isCollectionRequired
in interfaceReferencePropertyInfo<NType,NClass>
- Returns:
- Always false if
ReferencePropertyInfo.getXmlName()
==null.
-
getSchemaType
public javax.xml.namespace.QName getSchemaType()
Description copied from interface:PropertyInfo
The effective value ofXmlSchemaType
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 ofXmlSchemaType
(namely when this returns non-null, it overrides the type names of all types that are in this property.)- Specified by:
getSchemaType
in interfacePropertyInfo<NType,NClass>
-
isRequired
public boolean isRequired()
Description copied from interface:ReferencePropertyInfo
Returns true if this element is mandatory.- Specified by:
isRequired
in interfaceReferencePropertyInfo<NType,NClass>
-
collectElementNames
public javax.xml.namespace.QName collectElementNames(java.util.Map<javax.xml.namespace.QName,CPropertyInfo> table)
Description copied from class:CPropertyInfo
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.- Overrides:
collectElementNames
in classCPropertyInfo
- Returns:
- null if no conflict was found. Otherwise return the QName that has the collision.
-
-