com.sun.tools.xjc.model
Class CClassInfo

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

public final class CClassInfo
extends java.lang.Object
implements ClassInfo<NType,NClass>, CClassInfoParent, CClass, NClass

Mutable ClassInfo represenatation.

Schema parsers build these objects.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.tools.xjc.model.CClassInfoParent
CClassInfoParent.Package, CClassInfoParent.Visitor<T>
 
Field Summary
 java.lang.String javadoc
          TODO: revisit this design.
 Model model
          The Model object to which this bean belongs.
 java.lang.String shortName
          short name.
 
Fields inherited from interface com.sun.xml.bind.v2.model.core.NonElement
ANYTYPE_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.
 Element<NType,NClass> asElement()
          Returns the Element aspect of this ClassInfo.
 boolean canBeReferencedByIDREF()
          Deprecated. why are you calling an unimplemented method?
 com.sun.codemodel.JExpression createConstant(Outline outline, com.sun.xml.xsom.XmlString lexical)
           
 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.
 CAdapter getAdapterUse()
           
 CClassInfo getBaseClass()
          This inherited version returns null if this class extends from CClassRef.
 NClass getClazz()
          Gets the declaration this object is wrapping.
 java.util.Collection<? extends Constructor> getConstructors()
          list all constructor declarations.
 CCustomizations getCustomizations()
          Gets the list of customizations attached to this model component.
 javax.xml.namespace.QName getElementName()
          Gets the element name of the class, if the class is bound to an element.
 javax.activation.MimeType getExpectedMimeType()
          No default MimeType.
 CNonElement getInfo()
          Deprecated. 
 Location getLocation()
           
 org.xml.sax.Locator getLocator()
          Gets the source location in the schema from which this model component is created.
 java.lang.String getName()
          Gets the fully-qualified name of the class.
 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.
 CClassRef getRefBaseClass()
           
 com.sun.xml.xsom.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 bean token.
 CClassInfo getSubstitutionHead()
          If this element can substitute another element, return that element.
 NClass getType()
          Gets the underlying Java type that object represents.
 javax.xml.namespace.QName getTypeName()
          Gets the primary XML type ANYTYPE_NAME of the class.
 Locatable getUpstream()
           
 java.lang.String getUserSpecifiedImplClass()
           
 boolean hasAttributeWildcard()
          Returns true if this bean class has an attribute wildcard.
 void hasAttributeWildcard(boolean hasAttributeWildcard)
           
 boolean hasProperties()
          If the class has properties, return true.
 boolean hasSubClasses()
          True if there's a known sub-type of this class in TypeInfoSet.
 boolean hasValueProperty()
          Returns true if this class or its ancestor has XmlValue property.
 ID idUse()
           
 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 isCollection()
           
 boolean isElement()
          If the class is bound to an element, return true.
 boolean isFinal()
          Deprecated. if you are calling this method directly, you must be doing something wrong.
 boolean isOrdered()
          Returns true if the properties of this class is ordered in XML.
 boolean isSimpleType()
          Returns true if this NonElement maps to text in XML, without any attribute nor child elements.
 java.util.Iterator<CClassInfo> listSubclasses()
          Enumerates all the sub-classes of this class.
 CClassInfoParent parent()
           
 void setAbstract()
          Marks this element as an abstract element.
 void setBaseClass(CClass base)
          This method accepts both CClassInfo (which means the base class is also generated), or CClassRef (which means the base class is already generated and simply referenced.) The latter is treated somewhat special --- from the rest of the model this external base class is invisible.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sun.xml.bind.v2.model.core.ClassInfo
isAbstract
 
Methods inherited from interface com.sun.tools.xjc.model.CNonElement
getAdapterUse, isCollection
 
Methods inherited from interface com.sun.tools.xjc.model.TypeUse
createConstant, getExpectedMimeType, idUse
 
Methods inherited from interface com.sun.tools.xjc.model.CElement
isAbstract, setAbstract
 
Methods inherited from interface com.sun.tools.xjc.model.CCustomizable
getCustomizations, getLocator, getSchemaComponent
 
Methods inherited from interface com.sun.xml.bind.v2.model.core.TypeInfo
canBeReferencedByIDREF
 
Methods inherited from interface com.sun.tools.xjc.model.nav.NClass
isAbstract
 

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.

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

hasAttributeWildcard

public boolean hasAttributeWildcard()
Description copied from interface: ClassInfo
Returns true if this bean class has an attribute wildcard.

This is true if the class declares an attribute wildcard, or it is inherited from its super classes.

Specified by:
hasAttributeWildcard in interface ClassInfo<NType,NClass>
See Also:
ClassInfo.inheritsAttributeWildcard()

hasAttributeWildcard

public void hasAttributeWildcard(boolean hasAttributeWildcard)

hasSubClasses

public boolean hasSubClasses()
Description copied from interface: ClassInfo
True if there's a known sub-type of this class in TypeInfoSet.

Specified by:
hasSubClasses in interface 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 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 ClassInfo<NType,NClass>

getClazz

public NClass getClazz()
Description copied from interface: ClassInfo
Gets the declaration this object is wrapping.

Specified by:
getClazz in interface ClassInfo<NType,NClass>

getScope

public CClassInfo getScope()
Description copied from interface: Element
If non-null, this element is only active inside the given scope.

Specified by:
getScope in interface Element<NType,NClass>

getName

public java.lang.String getName()
Description copied from interface: ClassInfo
Gets the fully-qualified name of the class.

Specified by:
getName in interface 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 ClassInfo<NType,NClass>
Returns:
always non-null, but can be empty.

hasValueProperty

public boolean hasValueProperty()
Description copied from interface: ClassInfo
Returns true if this class or its ancestor has XmlValue property.

Specified by:
hasValueProperty in interface ClassInfo<NType,NClass>

getProperty

public CPropertyInfo getProperty(java.lang.String name)
Gets a propery by name.

Specified by:
getProperty in interface ClassInfo<NType,NClass>
Returns:
null if the property was not found.
See Also:
PropertyInfo.getName()

hasProperties

public boolean hasProperties()
Description copied from interface: ClassInfo
If the class has properties, return true. This is only true if the Collection object returned by ClassInfo.getProperties() is not empty.

Specified by:
hasProperties in interface ClassInfo<NType,NClass>

isElement

public boolean isElement()
Description copied from interface: MaybeElement
If the class is bound to an element, return true.

Note that when this is true, the class is bound to both an element and a type.

Specified by:
isElement in interface MaybeElement<NType,NClass>

getInfo

@Deprecated
public CNonElement getInfo()
Deprecated. 

Guaranteed to return this.

Specified by:
getInfo in interface CNonElement
Specified by:
getInfo in interface TypeUse

asElement

public Element<NType,NClass> asElement()
Description copied from interface: MaybeElement
Returns the Element aspect of this ClassInfo.

Specified by:
asElement in interface MaybeElement<NType,NClass>
Returns:
null if MaybeElement.isElement()==false, non-null if MaybeElement.isElement()==true.

isOrdered

public boolean isOrdered()
Description copied from interface: ClassInfo
Returns true if the properties of this class is ordered in XML. False if it't not.

In RELAX NG context, ordered properties mean <group> and unordered properties mean <interleave>.

Specified by:
isOrdered in interface ClassInfo<NType,NClass>

isFinal

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

Description copied from interface: ClassInfo
If this class is marked as final and no further extension/restriction is allowed.

Specified by:
isFinal in interface ClassInfo<NType,NClass>

setOrdered

public void setOrdered(boolean value)

getElementName

public javax.xml.namespace.QName getElementName()
Description copied from interface: MaybeElement
Gets the element name of the class, if the class is bound to an element.

Specified by:
getElementName in interface Element<NType,NClass>
Specified by:
getElementName in interface MaybeElement<NType,NClass>
Returns:
non-null iff MaybeElement.isElement().

getTypeName

public javax.xml.namespace.QName getTypeName()
Description copied from interface: NonElement
Gets the primary XML type ANYTYPE_NAME of the class.

A Java type can be mapped to multiple XML types, but one of them is considered "primary" and used when we generate a schema.

Specified by:
getTypeName in interface NonElement<NType,NClass>
Returns:
null if the object doesn't have an explicit type ANYTYPE_NAME (AKA anonymous.)

isSimpleType

public boolean isSimpleType()
Description copied from interface: NonElement
Returns true if this NonElement maps to text in XML, without any attribute nor child elements.

Specified by:
isSimpleType in interface 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(CClass base)
This method accepts both CClassInfo (which means the base class is also generated), or CClassRef (which means the base class is already generated and simply referenced.) The latter is treated somewhat special --- from the rest of the model this external base class is invisible. This modeling might need more thoughts to get right.


getBaseClass

public CClassInfo getBaseClass()
This inherited version returns null if this class extends from CClassRef.

Specified by:
getBaseClass in interface ClassInfo<NType,NClass>
Returns:
null if this info extends from Object.
See Also:
getRefBaseClass()

getRefBaseClass

public CClassRef getRefBaseClass()

listSubclasses

public java.util.Iterator<CClassInfo> listSubclasses()
Enumerates all the sub-classes of this class.


getSubstitutionHead

public CClassInfo getSubstitutionHead()
Description copied from interface: Element
If this element can substitute another element, return that element.

Substitutability of elements are transitive.

Specified by:
getSubstitutionHead in interface Element<NType,NClass>
Returns:
null if no such element exists.

_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()
Description copied from interface: TypeInfo
Gets the underlying Java type that object represents.

Specified by:
getType in interface TypeInfo<NType,NClass>
Returns:
always non-null.

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

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.

isAbstract

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

Specified by:
isAbstract in interface CElement

setAbstract

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

Specified by:
setAbstract in interface CElement

isCollection

public final boolean isCollection()

getAdapterUse

public final CAdapter getAdapterUse()

idUse

public final ID idUse()

getSchemaComponent

public final com.sun.xml.xsom.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 interface CCustomizable
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 with XmlIDREF.

Specified by:
canBeReferencedByIDREF in interface TypeInfo<NType,NClass>

getExpectedMimeType

public javax.activation.MimeType getExpectedMimeType()
No default MimeType.


getCustomizations

public CCustomizations getCustomizations()
Description copied from interface: CCustomizable
Gets the list of customizations attached to this model component.

Specified by:
getCustomizations in interface CCustomizable
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 com.sun.codemodel.JExpression createConstant(Outline outline,
                                                    com.sun.xml.xsom.XmlString lexical)

getUpstream

public final Locatable getUpstream()

getLocation

public final Location getLocation()