com.sun.tools.xjc.model
Class CClassInfo

java.lang.Object
  extended by com.sun.tools.xjc.model.AbstractCTypeInfoImpl
      extended by com.sun.tools.xjc.model.CClassInfo
All Implemented Interfaces:
CClassInfoParent, CCustomizable, CElement, CNonElement, CTypeInfo, NClass, NType, TypeUse, com.sun.xml.bind.v2.model.annotation.Locatable, com.sun.xml.bind.v2.model.core.ClassInfo<NType,NClass>, com.sun.xml.bind.v2.model.core.Element<NType,NClass>, com.sun.xml.bind.v2.model.core.MaybeElement<NType,NClass>, com.sun.xml.bind.v2.model.core.NonElement<NType,NClass>, com.sun.xml.bind.v2.model.core.TypeInfo<NType,NClass>

public final class CClassInfo
extends AbstractCTypeInfoImpl
implements com.sun.xml.bind.v2.model.core.ClassInfo<NType,NClass>, CClassInfoParent, CElement, CNonElement, NClass, CTypeInfo

Mutable ClassInfo represenatation.

Schema parsers build these objects.


Field Summary
 boolean isRootElement
          True if this element can be used as the root element.
 java.lang.String javadoc
          TODO: revisit this design.
 Model model
          The Model object to which this bean belongs.
 java.lang.String shortName
          short name.
 
Constructor Summary
CClassInfo(Model model, CClassInfoParent p, java.lang.String shortName, org.xml.sax.Locator location, javax.xml.namespace.QName typeName, javax.xml.namespace.QName elementName, com.sun.xml.xsom.XSComponent source, CCustomizations customizations)
           
CClassInfo(Model model, com.sun.codemodel.JCodeModel cm, java.lang.String fullName, org.xml.sax.Locator location, javax.xml.namespace.QName typeName, javax.xml.namespace.QName elementName, com.sun.xml.xsom.XSComponent source, CCustomizations customizations)
           
CClassInfo(Model model, com.sun.codemodel.JPackage pkg, java.lang.String shortName, org.xml.sax.Locator location, javax.xml.namespace.QName typeName, javax.xml.namespace.QName elementName, com.sun.xml.xsom.XSComponent source, CCustomizations customizations)
           
 
Method Summary
 void _implements(com.sun.codemodel.JClass c)
           
<T> T
accept(CClassInfoParent.Visitor<T> visitor)
           
 void addConstructor(java.lang.String... fieldNames)
          Creates a new constructor declaration and adds it.
 void addProperty(CPropertyInfo prop)
          Adds a new property.
 com.sun.xml.bind.v2.model.core.Element<NType,NClass> asElement()
           
 boolean declaresAttributeWildcard()
          Returns true iff a new attribute wildcard property needs to be declared on this class.
 java.lang.String fullName()
          Returns the FQCN of this bean.
 CClassInfo getBaseClass()
           
 NClass getClazz()
           
 java.util.Collection<? extends Constructor> getConstructors()
          list all constructor declarations.
 javax.xml.namespace.QName getElementName()
           
 org.xml.sax.Locator getLocator()
          Gets the source location in the schema from which this model component is created.
 java.lang.String getName()
           
 com.sun.codemodel.JPackage getOwnerPackage()
          Gets the nearest JPackage.
 java.util.List<CPropertyInfo> getProperties()
          Returns a mutable list.
 CPropertyInfo getProperty(java.lang.String name)
          Gets a propery by name.
 CClassInfo getScope()
           
 java.lang.String getSqueezedName()
          Returns the "squeezed name" of this bean token.
 CClassInfo getSubstitutionHead()
           
 NClass getType()
           
 javax.xml.namespace.QName getTypeName()
           
 java.lang.String getUserSpecifiedImplClass()
           
 boolean hasAttributeWildcard()
           
 void hasAttributeWildcard(boolean hasAttributeWildcard)
           
 boolean hasProperties()
           
 boolean hasSubClasses()
           
 boolean inheritsAttributeWildcard()
          Returns true iff this class inherits a wildcard attribute property from its ancestor classes.
 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 isElement()
           
 boolean isFinal()
          Deprecated. if you are calling this method directly, you must be doing something wrong.
 boolean isOrdered()
           
 boolean isSimpleType()
           
 CClassInfoParent parent()
           
 void setAbstract()
          Marks this element as an abstract element.
 void setBaseClass(CClassInfo base)
           
 void setOrdered(boolean value)
           
 void setUserSpecifiedImplClass(java.lang.String implClass)
           
 java.lang.String toString()
           
 com.sun.codemodel.JClass 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, 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.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.tools.xjc.model.TypeUse
createConstant, getAdapterUse, getExpectedMimeType, getInfo, idUse, isCollection
 
Methods inherited from interface com.sun.tools.xjc.model.CCustomizable
getCustomizations, getSchemaComponent
 

Field Detail

javadoc

public java.lang.String javadoc
TODO: revisit this design. we should at least do a basic encapsulation to avoid careless mistakes. Maybe we should even differ the javadoc generation by queueing runners.


shortName

public final java.lang.String shortName
short name.


model

public final Model model
The Model object to which this bean belongs.


isRootElement

public boolean isRootElement
True if this element can be used as the root element. never be true if isElement()==false.

Constructor Detail

CClassInfo

public CClassInfo(Model model,
                  com.sun.codemodel.JPackage pkg,
                  java.lang.String shortName,
                  org.xml.sax.Locator location,
                  javax.xml.namespace.QName typeName,
                  javax.xml.namespace.QName elementName,
                  com.sun.xml.xsom.XSComponent source,
                  CCustomizations customizations)

CClassInfo

public CClassInfo(Model model,
                  CClassInfoParent p,
                  java.lang.String shortName,
                  org.xml.sax.Locator location,
                  javax.xml.namespace.QName typeName,
                  javax.xml.namespace.QName elementName,
                  com.sun.xml.xsom.XSComponent source,
                  CCustomizations customizations)

CClassInfo

public CClassInfo(Model model,
                  com.sun.codemodel.JCodeModel cm,
                  java.lang.String fullName,
                  org.xml.sax.Locator location,
                  javax.xml.namespace.QName typeName,
                  javax.xml.namespace.QName elementName,
                  com.sun.xml.xsom.XSComponent source,
                  CCustomizations customizations)
Method Detail

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.

hasAttributeWildcard

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

hasAttributeWildcard

public void hasAttributeWildcard(boolean hasAttributeWildcard)

hasSubClasses

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

declaresAttributeWildcard

public boolean declaresAttributeWildcard()
Returns true iff a new attribute wildcard property needs to be declared on this class.

Specified by:
declaresAttributeWildcard in interface com.sun.xml.bind.v2.model.core.ClassInfo<NType,NClass>

inheritsAttributeWildcard

public boolean inheritsAttributeWildcard()
Returns true iff this class inherits a wildcard attribute property from its ancestor classes.

Specified by:
inheritsAttributeWildcard in interface com.sun.xml.bind.v2.model.core.ClassInfo<NType,NClass>

getClazz

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

getScope

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

getName

public java.lang.String getName()
Specified by:
getName in interface com.sun.xml.bind.v2.model.core.ClassInfo<NType,NClass>

getSqueezedName

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

The squeezed name of a bean is the concatenation of the names of its outer classes and itself.

Thus if the bean is "org.acme.foo.Bean", then the squeezed name is "Bean", if the bean is "org.acme.foo.Outer1.Outer2.Bean", then "Outer1Outer2Bean".

This is used by the code generator


getProperties

public java.util.List<CPropertyInfo> getProperties()
Returns a mutable list.

Specified by:
getProperties in interface com.sun.xml.bind.v2.model.core.ClassInfo<NType,NClass>

getProperty

public CPropertyInfo getProperty(java.lang.String name)
Gets a propery by name. TODO: consider moving this up to ClassInfo

Specified by:
getProperty in interface com.sun.xml.bind.v2.model.core.ClassInfo<NType,NClass>

hasProperties

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

isElement

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

asElement

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

isOrdered

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

isFinal

public boolean isFinal()
Deprecated. if you are calling this method directly, you must be doing something wrong.

Specified by:
isFinal in interface com.sun.xml.bind.v2.model.core.ClassInfo<NType,NClass>

setOrdered

public void setOrdered(boolean value)

getElementName

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

getTypeName

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

isSimpleType

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

fullName

public java.lang.String fullName()
Returns the FQCN of this bean.

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

parent

public CClassInfoParent parent()

setUserSpecifiedImplClass

public void setUserSpecifiedImplClass(java.lang.String implClass)

getUserSpecifiedImplClass

public java.lang.String getUserSpecifiedImplClass()

addProperty

public void addProperty(CPropertyInfo prop)
Adds a new property.


setBaseClass

public void setBaseClass(CClassInfo base)

getBaseClass

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

getSubstitutionHead

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

_implements

public void _implements(com.sun.codemodel.JClass c)

addConstructor

public void addConstructor(java.lang.String... fieldNames)
Creates a new constructor declaration and adds it.


getConstructors

public java.util.Collection<? extends Constructor> getConstructors()
list all constructor declarations.


accept

public final <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

getType

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

toType

public final com.sun.codemodel.JClass 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 NClass
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)

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

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
Specified by:
isAbstract in interface NClass
Specified by:
isAbstract in interface com.sun.xml.bind.v2.model.core.ClassInfo<NType,NClass>