Class CElementInfo
- java.lang.Object
-
- com.sun.tools.xjc.model.CElementInfo
-
- All Implemented Interfaces:
CClassInfoParent,CCustomizable,CElement,CTypeInfo,NType,com.sun.xml.bind.v2.model.annotation.Locatable,com.sun.xml.bind.v2.model.core.Element<NType,NClass>,com.sun.xml.bind.v2.model.core.ElementInfo<NType,NClass>,com.sun.xml.bind.v2.model.core.TypeInfo<NType,NClass>
public final class CElementInfo extends Object implements com.sun.xml.bind.v2.model.core.ElementInfo<NType,NClass>, NType, CClassInfoParent
ElementInfoimplementation 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 CClassInfoParentparentIf 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, QName tagName, CClassInfoParent parent, TypeUse contentType, XmlString defaultValue, XSElementDecl source, CCustomizations customizations, Locator location)Creates an element in the given parent.CElementInfo(Model model, QName tagName, CClassInfoParent parent, String className, CCustomizations customizations, 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> Taccept(CClassInfoParent.Visitor<T> visitor)booleancanBeReferencedByIDREF()Deprecated.why are you calling an unimplemented method?JExpressioncreateConstant(Outline outline, XmlString lexical)StringfullName()Human readable name of this type.CAdaptergetAdapterUse()NTypegetContentInMemoryType()CNonElementgetContentType()CCustomizationsgetCustomizations()Gets the list of customizations attached to this model component.StringgetDefaultValue()QNamegetElementName()MimeTypegetExpectedMimeType()No defaultMimeType.com.sun.xml.bind.v2.runtime.LocationgetLocation()LocatorgetLocator()Gets the source location in the schema from which this model component is created.JPackagegetOwnerPackage()Gets the nearestJPackage.CElementPropertyInfogetProperty()XSComponentgetSchemaComponent()If this model object is built from XML Schema, this property returns a schema component from which the model is built.CClassInfogetScope()StringgetSqueezedName()Returns the "squeezed name" of this element.CElementInfogetSubstitutionHead()Collection<CElementInfo>getSubstitutionMembers()NTypegetType()Deprecated.why are you calling a method that returns this?com.sun.xml.bind.v2.model.annotation.LocatablegetUpstream()booleanhasClass()True if this element has its own class (as opposed to be represented as an instance ofJAXBElement.com.sun.xml.bind.v2.model.core.IDidUse()voidinitContentType(TypeUse contentType, XSElementDecl source, XmlString defaultValue)booleanisAbstract()Returns true iff this element is an abstract element.booleanisBoxedType()Returns true iff this type represents a class that has a unboxed form.booleanisCollection()voidsetAbstract()Marks this element as an abstract element.voidsetSubstitutionHead(CElementInfo substitutionHead)StringshortName()JTypetoType(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
-
-
-
-
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, QName tagName, CClassInfoParent parent, TypeUse contentType, XmlString defaultValue, XSElementDecl source, CCustomizations customizations, 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, QName tagName, CClassInfoParent parent, String className, CCustomizations customizations, 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 haveCElementInfofor 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 String getDefaultValue()
-
_package
public final JPackage _package()
-
getContentType
public CNonElement getContentType()
-
getContentInMemoryType
public NType getContentInMemoryType()
-
getProperty
public CElementPropertyInfo getProperty()
-
getScope
public CClassInfo getScope()
-
getType
public NType getType()
Deprecated.why are you calling a method that returns this?
-
getElementName
public QName getElementName()
-
toType
public JType toType(Outline o, Aspect aspect)
Description copied from interface:NTypeReturns 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:
toTypein interfaceCTypeInfo- Specified by:
toTypein interfaceNTypeaspect- 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 String getSqueezedName()
Returns the "squeezed name" of this element.- See Also:
CClassInfo.getSqueezedName()
-
getSubstitutionHead
public CElementInfo getSubstitutionHead()
-
getSubstitutionMembers
public Collection<CElementInfo> getSubstitutionMembers()
-
setSubstitutionHead
public void setSubstitutionHead(CElementInfo substitutionHead)
-
isBoxedType
public boolean isBoxedType()
Description copied from interface:NTypeReturns true iff this type represents a class that has a unboxed form. For example, forStringthis is false, but forIntegerthis is true.- Specified by:
isBoxedTypein interfaceNType
-
fullName
public String fullName()
Description copied from interface:NTypeHuman readable name of this type.- Specified by:
fullNamein interfaceCClassInfoParent- Specified by:
fullNamein interfaceNType
-
accept
public <T> T accept(CClassInfoParent.Visitor<T> visitor)
- Specified by:
acceptin interfaceCClassInfoParent
-
getOwnerPackage
public JPackage getOwnerPackage()
Description copied from interface:CClassInfoParentGets the nearestJPackage.- Specified by:
getOwnerPackagein interfaceCClassInfoParent
-
shortName
public 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 Locator getLocator()
Description copied from interface:CCustomizableGets the source location in the schema from which this model component is created.- Specified by:
getLocatorin interfaceCCustomizable- Returns:
- never null.
-
isAbstract
public boolean isAbstract()
Description copied from interface:CElementReturns true iff this element is an abstract element.- Specified by:
isAbstractin interfaceCElement
-
setAbstract
public void setAbstract()
Description copied from interface:CElementMarks this element as an abstract element.- Specified by:
setAbstractin interfaceCElement
-
isCollection
public final boolean isCollection()
-
getAdapterUse
public final CAdapter getAdapterUse()
-
idUse
public final com.sun.xml.bind.v2.model.core.ID idUse()
-
getSchemaComponent
public final XSComponent getSchemaComponent()
Description copied from interface:CCustomizableIf this model object is built from XML Schema, this property returns a schema component from which the model is built.- Specified by:
getSchemaComponentin 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?
-
getCustomizations
public CCustomizations getCustomizations()
Description copied from interface:CCustomizableGets the list of customizations attached to this model component.- Specified by:
getCustomizationsin 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 com.sun.xml.bind.v2.model.annotation.Locatable getUpstream()
- Specified by:
getUpstreamin interfacecom.sun.xml.bind.v2.model.annotation.Locatable
-
getLocation
public final com.sun.xml.bind.v2.runtime.Location getLocation()
- Specified by:
getLocationin interfacecom.sun.xml.bind.v2.model.annotation.Locatable
-
-