Class CElementInfo
- java.lang.Object
-
- com.sun.tools.xjc.model.CElementInfo
-
- All Implemented Interfaces:
CClassInfoParent
,CCustomizable
,CElement
,CTypeInfo
,NType
,Locatable
,Element<NType,NClass>
,ElementInfo<NType,NClass>
,TypeInfo<NType,NClass>
public final class CElementInfo extends java.lang.Object implements ElementInfo<NType,NClass>, NType, CClassInfoParent
ElementInfo
implementation for the compile-time model.As an NType, it represents the Java representation of this element (either
JAXBElement<T>
or Foo).- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.sun.tools.xjc.model.CClassInfoParent
CClassInfoParent.Package, CClassInfoParent.Visitor<T>
-
-
Field Summary
Fields Modifier and Type Field Description CClassInfoParent
parent
If this element is global, the element info is considered to be package-level, and this points to the package in which this element lives in.
-
Constructor Summary
Constructors Constructor Description CElementInfo(Model model, javax.xml.namespace.QName tagName, CClassInfoParent parent, TypeUse contentType, XmlString defaultValue, XSElementDecl source, CCustomizations customizations, org.xml.sax.Locator location)
Creates an element in the given parent.CElementInfo(Model model, javax.xml.namespace.QName tagName, CClassInfoParent parent, java.lang.String className, CCustomizations customizations, org.xml.sax.Locator location)
Creates an element with a class in the given parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description JPackage
_package()
<T> T
accept(CClassInfoParent.Visitor<T> visitor)
boolean
canBeReferencedByIDREF()
Deprecated.why are you calling an unimplemented method?JExpression
createConstant(Outline outline, XmlString lexical)
java.lang.String
fullName()
Human readable name of this type.CAdapter
getAdapterUse()
NType
getContentInMemoryType()
T ofJAXBElement<T>
.CNonElement
getContentType()
Short forgetProperty().ref().get(0)
.CCustomizations
getCustomizations()
Gets the list of customizations attached to this model component.java.lang.String
getDefaultValue()
javax.xml.namespace.QName
getElementName()
Gets the element name of the class.javax.activation.MimeType
getExpectedMimeType()
No defaultMimeType
.Location
getLocation()
Gets the location object that this object points to.org.xml.sax.Locator
getLocator()
Gets the source location in the schema from which this model component is created.JPackage
getOwnerPackage()
Gets the nearestJPackage
.CElementPropertyInfo
getProperty()
Gets the object that represents the value property.XSComponent
getSchemaComponent()
If this model object is built from XML Schema, this property returns a schema component from which the model is built.CClassInfo
getScope()
If non-null, this element is only active inside the given scope.java.lang.String
getSqueezedName()
Returns the "squeezed name" of this element.CElementInfo
getSubstitutionHead()
If this element can substitute another element, return that element.java.util.Collection<CElementInfo>
getSubstitutionMembers()
All theElementInfo
s whoseElementInfo.getSubstitutionHead()
points to this object.NType
getType()
Deprecated.why are you calling a method that returns this?Locatable
getUpstream()
Gets the upstreamLocation
information.boolean
hasClass()
True if this element has its own class (as opposed to be represented as an instance ofJAXBElement
.ID
idUse()
void
initContentType(TypeUse contentType, XSElementDecl source, XmlString defaultValue)
boolean
isAbstract()
Returns true iff this element is an abstract element.boolean
isBoxedType()
Returns true iff this type represents a class that has a unboxed form.boolean
isCollection()
void
setAbstract()
Marks this element as an abstract element.void
setSubstitutionHead(CElementInfo substitutionHead)
java.lang.String
shortName()
JType
toType(Outline o, Aspect aspect)
Returns the representation of this type in code model.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.sun.tools.xjc.model.CCustomizable
getCustomizations, getSchemaComponent
-
Methods inherited from interface com.sun.xml.bind.v2.model.annotation.Locatable
getLocation, getUpstream
-
Methods inherited from interface com.sun.xml.bind.v2.model.core.TypeInfo
canBeReferencedByIDREF
-
-
-
-
Field Detail
-
parent
public final CClassInfoParent parent
If this element is global, the element info is considered to be package-level, and this points to the package in which this element lives in.For local elements, this points to the parent
CClassInfo
.
-
-
Constructor Detail
-
CElementInfo
public CElementInfo(Model model, javax.xml.namespace.QName tagName, CClassInfoParent parent, TypeUse contentType, XmlString defaultValue, XSElementDecl source, CCustomizations customizations, org.xml.sax.Locator location)
Creates an element in the given parent.When using this construction,
initContentType(TypeUse, XSElementDecl, XmlString)
must not be invoked.
-
CElementInfo
public CElementInfo(Model model, javax.xml.namespace.QName tagName, CClassInfoParent parent, java.lang.String className, CCustomizations customizations, org.xml.sax.Locator location)
Creates an element with a class in the given parent.When using this construction, the caller must use
initContentType(TypeUse, XSElementDecl, XmlString)
to fill in the content type later. This is to avoid a circular model construction dependency between buidling a type inside an element and element itself. To build a content type, you need to haveCElementInfo
for a parent, so we can't take it as a constructor parameter.
-
-
Method Detail
-
initContentType
public void initContentType(TypeUse contentType, @Nullable XSElementDecl source, XmlString defaultValue)
-
getDefaultValue
public final java.lang.String getDefaultValue()
-
_package
public final JPackage _package()
-
getContentType
public CNonElement getContentType()
Description copied from interface:ElementInfo
Short forgetProperty().ref().get(0)
. The type of the value this element holds. Normally, this is the T ofJAXBElement<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.- Specified by:
getContentType
in interfaceElementInfo<NType,NClass>
- See Also:
ElementInfo.getContentInMemoryType()
-
getContentInMemoryType
public NType getContentInMemoryType()
Description copied from interface:ElementInfo
T ofJAXBElement<T>
.This is tied to the in-memory representation.
- Specified by:
getContentInMemoryType
in interfaceElementInfo<NType,NClass>
- See Also:
ElementInfo.getContentType()
-
getProperty
public CElementPropertyInfo getProperty()
Description copied from interface:ElementInfo
Gets the object that represents the value property.- Specified by:
getProperty
in interfaceElementInfo<NType,NClass>
- Returns:
- non-null.
-
getScope
public CClassInfo getScope()
Description copied from interface:Element
If non-null, this element is only active inside the given scope.
-
getType
public NType getType()
Deprecated.why are you calling a method that returns this?Description copied from interface:ElementInfo
Returns the representation forJAXBElement
<contentInMemoryType>
.This returns the signature in Java and thus isn't affected by the adapter.
-
getElementName
public javax.xml.namespace.QName getElementName()
Description copied from interface:Element
Gets the element name of the class.- Specified by:
getElementName
in interfaceElement<NType,NClass>
- Returns:
- Always non-null.
-
toType
public JType toType(Outline o, Aspect aspect)
Description copied from interface:NType
Returns the representation of this type in code model.This operation requires the whole model to be built, and hence it takes
Outline
.Under some code generation strategy, some bean classes are considered implementation specific (such as impl.FooImpl class) These classes always have accompanying "exposed" type (such as the Foo interface).
For such Jekyll and Hyde type, the aspect parameter determines which personality is returned.
- Specified by:
toType
in interfaceCTypeInfo
- Specified by:
toType
in interfaceNType
aspect
- IfAspect.IMPLEMENTATION
, this method returns the implementation specific class that this type represents. IfAspect.EXPOSED
, this method returns the publicly exposed type that this type represents. For ordinary classes, the aspect parameter is meaningless.- See Also:
NType.toType(Outline, com.sun.tools.xjc.outline.Aspect)
-
getSqueezedName
public java.lang.String getSqueezedName()
Returns the "squeezed name" of this element.- See Also:
CClassInfo.getSqueezedName()
-
getSubstitutionHead
public CElementInfo getSubstitutionHead()
Description copied from interface:ElementInfo
If this element can substitute another element, return that element.Substitutability of elements are transitive.
ElementInfo
can only substituteElementInfo
.- Specified by:
getSubstitutionHead
in interfaceElement<NType,NClass>
- Specified by:
getSubstitutionHead
in interfaceElementInfo<NType,NClass>
- Returns:
- null if no such element exists.
-
getSubstitutionMembers
public java.util.Collection<CElementInfo> getSubstitutionMembers()
Description copied from interface:ElementInfo
All theElementInfo
s whoseElementInfo.getSubstitutionHead()
points to this object.- Specified by:
getSubstitutionMembers
in interfaceElementInfo<NType,NClass>
- Returns:
- can be empty but never null.
-
setSubstitutionHead
public void setSubstitutionHead(CElementInfo substitutionHead)
-
isBoxedType
public boolean isBoxedType()
Description copied from interface:NType
Returns true iff this type represents a class that has a unboxed form. For example, forString
this is false, but forInteger
this is true.- Specified by:
isBoxedType
in interfaceNType
-
fullName
public java.lang.String fullName()
Description copied from interface:NType
Human readable name of this type.- Specified by:
fullName
in interfaceCClassInfoParent
- Specified by:
fullName
in interfaceNType
-
accept
public <T> T accept(CClassInfoParent.Visitor<T> visitor)
- Specified by:
accept
in interfaceCClassInfoParent
-
getOwnerPackage
public JPackage getOwnerPackage()
Description copied from interface:CClassInfoParent
Gets the nearestJPackage
.- Specified by:
getOwnerPackage
in interfaceCClassInfoParent
-
shortName
public java.lang.String shortName()
-
hasClass
public boolean hasClass()
True if this element has its own class (as opposed to be represented as an instance ofJAXBElement
.
-
getLocator
public org.xml.sax.Locator getLocator()
Description copied from interface:CCustomizable
Gets the source location in the schema from which this model component is created.- Specified by:
getLocator
in interfaceCCustomizable
- Returns:
- never null.
-
isAbstract
public boolean isAbstract()
Description copied from interface:CElement
Returns true iff this element is an abstract element.- Specified by:
isAbstract
in interfaceCElement
-
setAbstract
public void setAbstract()
Description copied from interface:CElement
Marks this element as an abstract element.- Specified by:
setAbstract
in interfaceCElement
-
isCollection
public final boolean isCollection()
-
getAdapterUse
public final CAdapter getAdapterUse()
-
idUse
public final ID idUse()
-
getSchemaComponent
public final XSComponent getSchemaComponent()
Description copied from interface:CCustomizable
If this model object is built from XML Schema, this property returns a schema component from which the model is built.- Specified by:
getSchemaComponent
in interfaceCCustomizable
- Returns:
- null if the model is built from sources other than XML Schema (such as DTD.)
-
canBeReferencedByIDREF
public final boolean canBeReferencedByIDREF()
Deprecated.why are you calling an unimplemented method?Description copied from interface:TypeInfo
True if this type is a valid target from a property annotated withXmlIDREF
.- Specified by:
canBeReferencedByIDREF
in interfaceTypeInfo<NType,NClass>
-
getExpectedMimeType
public javax.activation.MimeType getExpectedMimeType()
No defaultMimeType
.
-
getCustomizations
public CCustomizations getCustomizations()
Description copied from interface:CCustomizable
Gets the list of customizations attached to this model component.- Specified by:
getCustomizations
in interfaceCCustomizable
- Returns:
- can be an empty list but never be null. The returned list is read-only. Do not modify.
- See Also:
Plugin.getCustomizationURIs()
-
createConstant
public JExpression createConstant(Outline outline, XmlString lexical)
-
getUpstream
public final Locatable getUpstream()
Description copied from interface:Locatable
Gets the upstreamLocation
information.- Specified by:
getUpstream
in interfaceLocatable
- Returns:
- can be null.
-
getLocation
public final Location getLocation()
Description copied from interface:Locatable
Gets the location object that this object points to. This operation could be inefficient and costly.- Specified by:
getLocation
in interfaceLocatable
-
-