Class 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>
ClassInfo
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
FieldsModifier and TypeFieldDescriptionTODO: revisit this design.final Model
TheModel
object to which this bean belongs.final String
short name.Fields inherited from interface com.sun.xml.bind.v2.model.core.NonElement
ANYTYPE_NAME
-
Constructor Summary
ConstructorsConstructorDescriptionCClassInfo
(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
Modifier and TypeMethodDescriptionvoid
final <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.final boolean
Deprecated.why are you calling an unimplemented method?createConstant
(Outline outline, XmlString lexical) boolean
Returns true if a new attribute wildcard property needs to be declared on this class.fullName()
Returns the FQCN of this bean.final CAdapter
This inherited version returns null if this class extends fromCClassRef
.getClazz()
Gets the declaration this object is wrapping.Collection<? extends Constructor>
list all constructor declarations.Gets the list of customizations attached to this model component.Gets the element name of the class, if the class is bound to an element.No defaultMimeType
.getInfo()
Deprecated.final Location
Gets the location object that this object points to.Gets the source location in the schema from which this model component is created.getName()
Gets the fully-qualified name of the class.Gets the nearestJPackage
.Returns a mutable list.getProperty
(String name) Gets a propery by name.final XSComponent
If this model object is built from XML Schema, this property returns a schema component from which the model is built.getScope()
If non-null, this element is only active inside the given scope.Returns the "squeezed name" of this bean token.If this element can substitute another element, return that element.final NClass
getType()
Gets the underlying Java type that object represents.Gets the primary XML type ANYTYPE_NAME of the class.final Locatable
Gets the upstreamLocation
information.boolean
Returns true if this bean class has an attribute wildcard.void
hasAttributeWildcard
(boolean hasAttributeWildcard) boolean
If the class has properties, return true.boolean
True if there's a known sub-type of this class inTypeInfoSet
.boolean
Returns true if this class or its ancestor hasXmlValue
property.final ID
idUse()
boolean
Returns true if this class inherits a wildcard attribute property from its ancestor classes.boolean
Returns true iff this element is an abstract element.boolean
Returns true iff this type represents a class that has a unboxed form.final boolean
boolean
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
Returns true if the properties of this class is ordered in XML.boolean
Returns true if thisNonElement
maps to text in XML, without any attribute nor child elements.Enumerates all the sub-classes of this class.parent()
void
Marks this element as an abstract element.void
setBaseClass
(CClass base) This method accepts bothCClassInfo
(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) toString()
final JClass
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 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.xml.bind.v2.model.annotation.Locatable
getLocation, getUpstream
Methods inherited from interface com.sun.tools.xjc.model.nav.NClass
isAbstract
Methods inherited from interface com.sun.xml.bind.v2.model.core.TypeInfo
canBeReferencedByIDREF
Methods inherited from interface com.sun.tools.xjc.model.TypeUse
createConstant, getExpectedMimeType, idUse
-
Field Details
-
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
short name. -
model
TheModel
object to which this bean belongs.
-
-
Constructor Details
-
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 Details
-
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 interfaceClassInfo<NType,
NClass> - See Also:
-
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 inTypeInfoSet
.- 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>
-
getClazz
Description copied from interface:ClassInfo
Gets the declaration this object is wrapping. -
getScope
Description copied from interface:Element
If non-null, this element is only active inside the given scope. -
getName
Description copied from interface:ClassInfo
Gets the fully-qualified name of the class. -
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
Returns a mutable list.- Specified by:
getProperties
in interfaceClassInfo<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 hasXmlValue
property.- Specified by:
hasValueProperty
in interfaceClassInfo<NType,
NClass>
-
getProperty
Gets a propery by name.- Specified by:
getProperty
in interfaceClassInfo<NType,
NClass> - Returns:
- null if the property was not found.
- See Also:
-
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 byClassInfo.getProperties()
is not empty.- Specified by:
hasProperties
in interfaceClassInfo<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 interfaceMaybeElement<NType,
NClass>
-
getInfo
Deprecated.Guaranteed to return this.- Specified by:
getInfo
in interfaceCNonElement
- Specified by:
getInfo
in interfaceTypeUse
-
asElement
Description copied from interface:MaybeElement
- Specified by:
asElement
in interfaceMaybeElement<NType,
NClass> - Returns:
- null if
MaybeElement.isElement()
==false, non-null ifMaybeElement.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>
. -
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. -
setOrdered
public void setOrdered(boolean value) -
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 interfaceElement<NType,
NClass> - Specified by:
getElementName
in interfaceMaybeElement<NType,
NClass> - Returns:
- non-null iff
MaybeElement.isElement()
.
-
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 interfaceNonElement<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 thisNonElement
maps to text in XML, without any attribute nor child elements.- Specified by:
isSimpleType
in interfaceNonElement<NType,
NClass>
-
fullName
Returns the FQCN of this bean.- Specified by:
fullName
in interfaceCClassInfoParent
- Specified by:
fullName
in interfaceNType
-
parent
-
setUserSpecifiedImplClass
-
getUserSpecifiedImplClass
-
addProperty
Adds a new property. -
setBaseClass
This method accepts bothCClassInfo
(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
This inherited version returns null if this class extends fromCClassRef
.- Specified by:
getBaseClass
in interfaceClassInfo<NType,
NClass> - Returns:
- null
if this info extends from
Object
. - See Also:
-
getRefBaseClass
-
listSubclasses
Enumerates all the sub-classes of this class. -
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 interfaceElement<NType,
NClass> - Returns:
- null if no such element exists.
-
_implements
-
addConstructor
Creates a new constructor declaration and adds it. -
getConstructors
list all constructor declarations. -
accept
- Specified by:
accept
in interfaceCClassInfoParent
-
getOwnerPackage
Description copied from interface:CClassInfoParent
Gets the nearestJPackage
.- Specified by:
getOwnerPackage
in interfaceCClassInfoParent
-
getType
Description copied from interface:TypeInfo
Gets the underlying Java type that object represents. -
toType
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:
-
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
-
toString
-
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
-
idUse
-
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
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 withXmlIDREF
.- Specified by:
canBeReferencedByIDREF
in interfaceTypeInfo<NType,
NClass>
-
getExpectedMimeType
No defaultMimeType
. -
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:
-
createConstant
-
getUpstream
Description copied from interface:Locatable
Gets the upstreamLocation
information.- Specified by:
getUpstream
in interfaceLocatable
- Returns:
- can be null.
-
getLocation
Description copied from interface:Locatable
Gets the location object that this object points to. This operation could be inefficient and costly.- Specified by:
getLocation
in interfaceLocatable
-