com.sun.tools.xjc.model
Class CClassRef

java.lang.Object
  extended by com.sun.tools.xjc.model.AbstractCTypeInfoImpl
      extended by com.sun.tools.xjc.model.AbstractCElement
          extended by com.sun.tools.xjc.model.CClassRef
All Implemented Interfaces:
CClass, CCustomizable, CElement, CNonElement, CTypeInfo, NClass, NType, TypeUse, Locatable, Element<NType,NClass>, NonElement<NType,NClass>, TypeInfo<NType,NClass>

public final class CClassRef
extends AbstractCElement
implements NClass, CClass

Refernece to an existing class.


Field Summary
 
Fields inherited from interface com.sun.xml.bind.v2.model.core.NonElement
ANYTYPE_NAME
 
Constructor Summary
CClassRef(Model model, XSComponent source, BIClass decl, CCustomizations customizations)
           
CClassRef(Model model, XSComponent source, BIEnum decl, CCustomizations customizations)
           
 
Method Summary
 String fullName()
          Human readable name of this type.
 QName getElementName()
          Gets the element name of the class.
 CNonElement getInfo()
          Deprecated. 
 CClassInfo getScope()
          If non-null, this element is only active inside the given scope.
 CElement getSubstitutionHead()
          If this element can substitute another element, return that element.
 NType getType()
          Gets the underlying Java type that object represents.
 QName getTypeName()
          Gets the primary XML type ANYTYPE_NAME of the class.
 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 isSimpleType()
          Returns true if this NonElement maps to text in XML, without any attribute nor child elements.
 void setAbstract()
          Marks this element as an abstract element.
 com.sun.codemodel.JClass toType(Outline o, Aspect aspect)
          Returns the representation of this type in code model.
 
Methods inherited from class com.sun.tools.xjc.model.AbstractCElement
getLocator
 
Methods inherited from class com.sun.tools.xjc.model.AbstractCTypeInfoImpl
canBeReferencedByIDREF, createConstant, getAdapterUse, getCustomizations, getExpectedMimeType, 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.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.CCustomizable
getCustomizations, getLocator, 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
 

Constructor Detail

CClassRef

public CClassRef(Model model,
                 XSComponent source,
                 BIClass decl,
                 CCustomizations customizations)
Parameters:
decl - The BIClass declaration that has BIClass.getExistingClassRef()

CClassRef

public CClassRef(Model model,
                 XSComponent source,
                 BIEnum decl,
                 CCustomizations customizations)
Parameters:
decl - The BIClass declaration that has BIEnum.ref
Method Detail

setAbstract

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

Specified by:
setAbstract in interface CElement
Overrides:
setAbstract in class AbstractCElement

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
Overrides:
isAbstract in class AbstractCElement

getType

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

fullName

public String fullName()
Description copied from interface: NType
Human readable name of this type.

Specified by:
fullName in interface NType

getTypeName

public 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.)

getInfo

@Deprecated
public CNonElement getInfo()
Deprecated. 

Guaranteed to return this.

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

getSubstitutionHead

public CElement 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.

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>

getElementName

public QName getElementName()
Description copied from interface: Element
Gets the element name of the class.

Specified by:
getElementName in interface Element<NType,NClass>
Returns:
Always non-null.

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

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>