- java.lang.Object
-
- com.sun.tools.xjc.model.CClassInfo
-
- All Implemented Interfaces:
CClass
,CClassInfoParent
,CCustomizable
,CElement
,CNonElement
,CTypeInfo
,NClass
,NType
,TypeUse
,Locatable
,ClassInfo<NType,NClass>
,Element<NType,NClass>
,MaybeElement<NType,NClass>
,NonElement<NType,NClass>
,TypeInfo<NType,NClass>
public final class CClassInfo extends Object implements ClassInfo<NType,NClass>, CClassInfoParent, CClass, NClass
MutableClassInfo
representation.Schema parsers build these objects.
- 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 String
javadoc
TODO: revisit this design.Model
model
TheModel
object to which this bean belongs.String
shortName
short name.-
Fields inherited from interface org.glassfish.jaxb.core.v2.model.core.NonElement
ANYTYPE_NAME
-
-
Constructor Summary
Constructors Constructor Description CClassInfo(Model model, JCodeModel cm, String fullName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations)
CClassInfo(Model model, JPackage pkg, String shortName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations)
CClassInfo(Model model, CClassInfoParent p, String shortName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
_implements(JClass c)
<T> T
accept(CClassInfoParent.Visitor<T> visitor)
void
addConstructor(String... fieldNames)
Creates a new constructor declaration and adds it.void
addProperty(CPropertyInfo prop)
Adds a new property.Element<NType,NClass>
asElement()
boolean
canBeReferencedByIDREF()
Deprecated.why are you calling an unimplemented method?JExpression
createConstant(Outline outline, XmlString lexical)
boolean
declaresAttributeWildcard()
Returns true if a new attribute wildcard property needs to be declared on this class.String
fullName()
Returns the FQCN of this bean.CAdapter
getAdapterUse()
CClassInfo
getBaseClass()
This inherited version returns null if this class extends fromCClassRef
.NClass
getClazz()
Collection<? extends Constructor>
getConstructors()
list all constructor declarations.CCustomizations
getCustomizations()
Gets the list of customizations attached to this model component.QName
getElementName()
jakarta.activation.MimeType
getExpectedMimeType()
No defaultMimeType
.CNonElement
getInfo()
Deprecated.Location
getLocation()
Locator
getLocator()
Gets the source location in the schema from which this model component is created.String
getName()
JPackage
getOwnerPackage()
Gets the nearestJPackage
.List<CPropertyInfo>
getProperties()
Returns a mutable list.CPropertyInfo
getProperty(String name)
Gets a propery by name.CClassRef
getRefBaseClass()
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()
String
getSqueezedName()
Returns the "squeezed name" of this bean token.CClassInfo
getSubstitutionHead()
NClass
getType()
QName
getTypeName()
Locatable
getUpstream()
String
getUserSpecifiedImplClass()
boolean
hasAttributeWildcard()
void
hasAttributeWildcard(boolean hasAttributeWildcard)
boolean
hasProperties()
boolean
hasSubClasses()
boolean
hasValueProperty()
ID
idUse()
boolean
inheritsAttributeWildcard()
Returns true if 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()
boolean
isFinal()
Deprecated.if you are calling this method directly, you must be doing something wrong.boolean
isOrdered()
boolean
isSimpleType()
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 (which means the base class is also generated), orCClassRef
(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(String implClass)
String
toString()
JClass
toType(Outline o, Aspect aspect)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.sun.tools.xjc.model.CCustomizable
getCustomizations, getLocator, getSchemaComponent
-
Methods inherited from interface com.sun.tools.xjc.model.CElement
isAbstract, setAbstract
-
Methods inherited from interface org.glassfish.jaxb.core.v2.model.core.ClassInfo
isAbstract
-
Methods inherited from interface com.sun.tools.xjc.model.CNonElement
getAdapterUse, isCollection
-
Methods inherited from interface org.glassfish.jaxb.core.v2.model.annotation.Locatable
getLocation, getUpstream
-
Methods inherited from interface com.sun.tools.xjc.model.nav.NClass
isAbstract
-
Methods inherited from interface org.glassfish.jaxb.core.v2.model.core.TypeInfo
canBeReferencedByIDREF
-
Methods inherited from interface com.sun.tools.xjc.model.TypeUse
createConstant, getExpectedMimeType, idUse
-
-
-
-
Constructor Detail
-
CClassInfo
public CClassInfo(Model model, JPackage pkg, String shortName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations)
-
CClassInfo
public CClassInfo(Model model, CClassInfoParent p, String shortName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations)
-
CClassInfo
public CClassInfo(Model model, JCodeModel cm, String fullName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations)
-
-
Method Detail
-
hasAttributeWildcard
public boolean hasAttributeWildcard()
- Specified by:
hasAttributeWildcard
in interfaceClassInfo<NType,NClass>
-
hasAttributeWildcard
public void hasAttributeWildcard(boolean hasAttributeWildcard)
-
hasSubClasses
public boolean hasSubClasses()
- Specified by:
hasSubClasses
in interfaceClassInfo<NType,NClass>
-
declaresAttributeWildcard
public boolean declaresAttributeWildcard()
Returns true if a new attribute wildcard property needs to be declared on this class.- Specified by:
declaresAttributeWildcard
in interfaceClassInfo<NType,NClass>
-
inheritsAttributeWildcard
public boolean inheritsAttributeWildcard()
Returns true if this class inherits a wildcard attribute property from its ancestor classes.- Specified by:
inheritsAttributeWildcard
in interfaceClassInfo<NType,NClass>
-
getScope
public CClassInfo getScope()
-
getSqueezedName
public 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 List<CPropertyInfo> getProperties()
Returns a mutable list.- Specified by:
getProperties
in interfaceClassInfo<NType,NClass>
-
hasValueProperty
public boolean hasValueProperty()
- Specified by:
hasValueProperty
in interfaceClassInfo<NType,NClass>
-
getProperty
public CPropertyInfo getProperty(String name)
Gets a propery by name.- Specified by:
getProperty
in interfaceClassInfo<NType,NClass>
-
hasProperties
public boolean hasProperties()
- Specified by:
hasProperties
in interfaceClassInfo<NType,NClass>
-
isElement
public boolean isElement()
- Specified by:
isElement
in interfaceMaybeElement<NType,NClass>
-
getInfo
@Deprecated public CNonElement getInfo()
Deprecated.Guaranteed to return this.- Specified by:
getInfo
in interfaceCNonElement
- Specified by:
getInfo
in interfaceTypeUse
-
asElement
public Element<NType,NClass> asElement()
- Specified by:
asElement
in interfaceMaybeElement<NType,NClass>
-
isFinal
@Deprecated public boolean isFinal()
Deprecated.if you are calling this method directly, you must be doing something wrong.
-
setOrdered
public void setOrdered(boolean value)
-
getElementName
public QName getElementName()
- Specified by:
getElementName
in interfaceElement<NType,NClass>
- Specified by:
getElementName
in interfaceMaybeElement<NType,NClass>
-
getTypeName
public QName getTypeName()
- Specified by:
getTypeName
in interfaceNonElement<NType,NClass>
-
isSimpleType
public boolean isSimpleType()
- Specified by:
isSimpleType
in interfaceNonElement<NType,NClass>
-
fullName
public String fullName()
Returns the FQCN of this bean.- Specified by:
fullName
in interfaceCClassInfoParent
- Specified by:
fullName
in interfaceNType
-
parent
public CClassInfoParent parent()
-
setUserSpecifiedImplClass
public void setUserSpecifiedImplClass(String implClass)
-
getUserSpecifiedImplClass
public String getUserSpecifiedImplClass()
-
addProperty
public void addProperty(CPropertyInfo prop)
Adds a new property.
-
setBaseClass
public void setBaseClass(CClass base)
This method accepts both (which means the base class is also generated), orCClassRef
(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 fromCClassRef
.- Specified by:
getBaseClass
in interfaceClassInfo<NType,NClass>
- See Also:
getRefBaseClass()
-
getRefBaseClass
public CClassRef getRefBaseClass()
-
listSubclasses
public Iterator<CClassInfo> listSubclasses()
Enumerates all the sub-classes of this class.
-
getSubstitutionHead
public CClassInfo getSubstitutionHead()
- Specified by:
getSubstitutionHead
in interfaceElement<NType,NClass>
-
_implements
public void _implements(JClass c)
-
addConstructor
public void addConstructor(String... fieldNames)
Creates a new constructor declaration and adds it.
-
getConstructors
public Collection<? extends Constructor> getConstructors()
list all constructor declarations.
-
accept
public <T> T accept(CClassInfoParent.Visitor<T> visitor)
- Specified by:
accept
in interfaceCClassInfoParent
-
getOwnerPackage
public JPackage getOwnerPackage()
Description copied from interface:CClassInfoParent
Gets the nearestJPackage
.- Specified by:
getOwnerPackage
in interfaceCClassInfoParent
-
toType
public JClass toType(Outline o, Aspect aspect)
Description copied from interface:CTypeInfo
- Specified by:
toType
in interfaceCTypeInfo
- Specified by:
toType
in interfaceNClass
- Specified by:
toType
in interfaceNType
aspect
- 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)
-
isBoxedType
public boolean isBoxedType()
Description copied from interface:NType
Returns true iff this type represents a class that has a unboxed form. For example, forString
this is false, but forInteger
this is true.- Specified by:
isBoxedType
in interfaceNType
-
getLocator
public 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 interfaceCCustomizable
- 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 interfaceCElement
-
setAbstract
public void setAbstract()
Description copied from interface:CElement
Marks this element as an abstract element.- Specified by:
setAbstract
in interfaceCElement
-
isCollection
public final boolean isCollection()
-
getAdapterUse
public final CAdapter getAdapterUse()
-
idUse
public final ID idUse()
-
getSchemaComponent
public final 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 interfaceCCustomizable
- Returns:
- null if the model is built from sources other than XML Schema (such as DTD.)
-
canBeReferencedByIDREF
@Deprecated public final boolean canBeReferencedByIDREF()
Deprecated.why are you calling an unimplemented method?- Specified by:
canBeReferencedByIDREF
in interfaceTypeInfo<NType,NClass>
-
getExpectedMimeType
public jakarta.activation.MimeType getExpectedMimeType()
No defaultMimeType
.
-
getCustomizations
public CCustomizations getCustomizations()
Description copied from interface:CCustomizable
Gets the list of customizations attached to this model component.- Specified by:
getCustomizations
in 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 Locatable getUpstream()
- Specified by:
getUpstream
in interfaceLocatable
-
getLocation
public final Location getLocation()
- Specified by:
getLocation
in interfaceLocatable
-
-