com.sun.tools.xjc.model
Class CElementInfo

java.lang.Object
  extended by com.sun.tools.xjc.model.AbstractCTypeInfoImpl
      extended by com.sun.tools.xjc.model.CElementInfo
All Implemented Interfaces:
CClassInfoParent, CCustomizable, CElement, CTypeInfo, NType, TypeUse, 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 AbstractCTypeInfoImpl
implements com.sun.xml.bind.v2.model.core.ElementInfo<NType,NClass>, CElement, CTypeInfo, 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).


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.tools.xjc.model.CClassInfoParent
CClassInfoParent.Package, CClassInfoParent.Visitor<T>
 
Field Summary
 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
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.
CElementInfo(Model model, javax.xml.namespace.QName tagName, CClassInfoParent parent, TypeUse contentType, com.sun.xml.xsom.XmlString defaultValue, com.sun.xml.xsom.XSComponent source, CCustomizations customizations, org.xml.sax.Locator location)
          Creates an element in the given parent.
 
Method Summary
 com.sun.codemodel.JPackage _package()
           
<T> T
accept(CClassInfoParent.Visitor<T> visitor)
           
 java.lang.String fullName()
          Returns the fully-qualified name.
 NType getContentInMemoryType()
           
 CNonElement getContentType()
           
 java.lang.String getDefaultValue()
           
 javax.xml.namespace.QName getElementName()
           
 org.xml.sax.Locator getLocator()
          Gets the source location in the schema from which this model component is created.
 com.sun.codemodel.JPackage getOwnerPackage()
          Gets the nearest JPackage.
 CElementPropertyInfo getProperty()
           
 CClassInfo getScope()
           
 java.lang.String getSqueezedName()
          Returns the "squeezed name" of this element.
 CElementInfo getSubstitutionHead()
           
 java.util.Collection<CElementInfo> getSubstitutionMembers()
           
 NType getType()
           
 boolean hasClass()
          True if this element has its own class (as opposed to be represented as an instance of JAXBElement.
 void initContentType(TypeUse contentType, com.sun.xml.xsom.XSComponent source, com.sun.xml.xsom.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.
 void setAbstract()
          Marks this element as an abstract element.
 void setSubstitutionHead(CElementInfo substitutionHead)
           
 java.lang.String shortName()
           
 com.sun.codemodel.JType toType(Outline o, Aspect aspect)
          Returns the JClass that represents the class being bound, under the given Outline.
 
Methods inherited from class com.sun.tools.xjc.model.AbstractCTypeInfoImpl
canBeReferencedByIDREF, createConstant, getAdapterUse, getCustomizations, getExpectedMimeType, getInfo, getLocation, getSchemaComponent, getUpstream, idUse, isCollection
 
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.core.TypeInfo
canBeReferencedByIDREF
 
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
 
Methods inherited from interface com.sun.xml.bind.v2.model.annotation.Locatable
getLocation, getUpstream
 
Methods inherited from interface com.sun.tools.xjc.model.TypeUse
createConstant, getAdapterUse, getExpectedMimeType, getInfo, idUse, isCollection
 
Methods inherited from interface com.sun.tools.xjc.model.CCustomizable
getCustomizations, getSchemaComponent
 
Methods inherited from interface com.sun.xml.bind.v2.model.core.TypeInfo
canBeReferencedByIDREF
 
Methods inherited from interface com.sun.xml.bind.v2.model.annotation.Locatable
getLocation, getUpstream
 

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,
                    com.sun.xml.xsom.XmlString defaultValue,
                    com.sun.xml.xsom.XSComponent source,
                    CCustomizations customizations,
                    org.xml.sax.Locator location)
Creates an element in the given parent.

When using this construction, initContentType(TypeUse, XSComponent, 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, XSComponent, 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 have CElementInfo for a parent, so we can't take it as a constructor parameter.

Method Detail

initContentType

public void initContentType(TypeUse contentType,
                            com.sun.xml.xsom.XSComponent source,
                            com.sun.xml.xsom.XmlString defaultValue)

getDefaultValue

public final java.lang.String getDefaultValue()

_package

public final com.sun.codemodel.JPackage _package()

getContentType

public CNonElement getContentType()
Specified by:
getContentType in interface com.sun.xml.bind.v2.model.core.ElementInfo<NType,NClass>

getContentInMemoryType

public NType getContentInMemoryType()
Specified by:
getContentInMemoryType in interface com.sun.xml.bind.v2.model.core.ElementInfo<NType,NClass>

getProperty

public CElementPropertyInfo getProperty()
Specified by:
getProperty in interface com.sun.xml.bind.v2.model.core.ElementInfo<NType,NClass>

getScope

public CClassInfo getScope()
Specified by:
getScope in interface com.sun.xml.bind.v2.model.core.Element<NType,NClass>

getType

public NType getType()
Specified by:
getType in interface com.sun.xml.bind.v2.model.core.ElementInfo<NType,NClass>
Specified by:
getType in interface com.sun.xml.bind.v2.model.core.TypeInfo<NType,NClass>

getElementName

public javax.xml.namespace.QName getElementName()
Specified by:
getElementName in interface com.sun.xml.bind.v2.model.core.Element<NType,NClass>

toType

public com.sun.codemodel.JType toType(Outline o,
                                      Aspect aspect)
Description copied from interface: CTypeInfo
Returns the JClass that represents the class being bound, under the given Outline.

Specified by:
toType in interface CTypeInfo
Specified by:
toType in interface NType
aspect - If Aspect.IMPLEMENTATION, this method returns the implementation specific class that this type represents. If Aspect.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, Aspect)

getSqueezedName

public java.lang.String getSqueezedName()
Returns the "squeezed name" of this element.

See Also:
CClassInfo.getSqueezedName()

setAbstract

public void setAbstract()
Description copied from interface: CElement
Marks this element as an abstract element.

Specified by:
setAbstract in interface CElement

isAbstract

public boolean isAbstract()
Description copied from interface: CElement
Returns true iff this element is an abstract element.

Specified by:
isAbstract in interface CElement

getSubstitutionHead

public CElementInfo getSubstitutionHead()
Specified by:
getSubstitutionHead in interface com.sun.xml.bind.v2.model.core.Element<NType,NClass>
Specified by:
getSubstitutionHead in interface com.sun.xml.bind.v2.model.core.ElementInfo<NType,NClass>

getSubstitutionMembers

public java.util.Collection<CElementInfo> getSubstitutionMembers()
Specified by:
getSubstitutionMembers in interface com.sun.xml.bind.v2.model.core.ElementInfo<NType,NClass>

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, for String this is false, but for Integer this is true.

Specified by:
isBoxedType in interface NType

fullName

public java.lang.String fullName()
Description copied from interface: CClassInfoParent
Returns the fully-qualified name.

Specified by:
fullName in interface CClassInfoParent
Specified by:
fullName in interface NType

accept

public <T> T accept(CClassInfoParent.Visitor<T> visitor)
Specified by:
accept in interface CClassInfoParent

getOwnerPackage

public com.sun.codemodel.JPackage getOwnerPackage()
Description copied from interface: CClassInfoParent
Gets the nearest JPackage.

Specified by:
getOwnerPackage in interface CClassInfoParent

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 of JAXBElement.


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 interface CCustomizable
Returns:
never null.