- 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
MutableClassInforepresentation.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 StringjavadocTODO: revisit this design.ModelmodelTheModelobject to which this bean belongs.StringshortNameshort 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> Taccept(CClassInfoParent.Visitor<T> visitor)voidaddConstructor(String... fieldNames)Creates a new constructor declaration and adds it.voidaddProperty(CPropertyInfo prop)Adds a new property.Element<NType,NClass>asElement()booleancanBeReferencedByIDREF()Deprecated.why are you calling an unimplemented method?JExpressioncreateConstant(Outline outline, XmlString lexical)booleandeclaresAttributeWildcard()Returns true if a new attribute wildcard property needs to be declared on this class.StringfullName()Returns the FQCN of this bean.CAdaptergetAdapterUse()CClassInfogetBaseClass()This inherited version returns null if this class extends fromCClassRef.NClassgetClazz()Gets the declaration this object is wrapping.Collection<? extends Constructor>getConstructors()list all constructor declarations.CCustomizationsgetCustomizations()Gets the list of customizations attached to this model component.QNamegetElementName()Gets the element name of the class, if the class is bound to an element.jakarta.activation.MimeTypegetExpectedMimeType()No defaultMimeType.CNonElementgetInfo()Deprecated.LocationgetLocation()Gets the location object that this object points to.LocatorgetLocator()Gets the source location in the schema from which this model component is created.StringgetName()Gets the fully-qualified name of the class.JPackagegetOwnerPackage()Gets the nearestJPackage.List<CPropertyInfo>getProperties()Returns a mutable list.CPropertyInfogetProperty(String name)Gets a propery by name.CClassRefgetRefBaseClass()XSComponentgetSchemaComponent()If this model object is built from XML Schema, this property returns a schema component from which the model is built.CClassInfogetScope()If non-null, this element is only active inside the given scope.StringgetSqueezedName()Returns the "squeezed name" of this bean token.CClassInfogetSubstitutionHead()If this element can substitute another element, return that element.NClassgetType()Gets the underlying Java type that object represents.QNamegetTypeName()Gets the primary XML type ANYTYPE_NAME of the class.LocatablegetUpstream()Gets the upstreamLocationinformation.StringgetUserSpecifiedImplClass()booleanhasAttributeWildcard()Returns true if this bean class has an attribute wildcard.voidhasAttributeWildcard(boolean hasAttributeWildcard)booleanhasProperties()If the class has properties, return true.booleanhasSubClasses()True if there's a known sub-type of this class inTypeInfoSet.booleanhasValueProperty()Returns true if this class or its ancestor hasXmlValueproperty.IDidUse()booleaninheritsAttributeWildcard()Returns true if this class inherits a wildcard attribute property from its ancestor classes.booleanisAbstract()Returns true iff this element is an abstract element.booleanisBoxedType()Returns true iff this type represents a class that has a unboxed form.booleanisCollection()booleanisElement()If the class is bound to an element, return true.booleanisFinal()Deprecated.if you are calling this method directly, you must be doing something wrong.booleanisOrdered()Returns true if the properties of this class is ordered in XML.booleanisSimpleType()Returns true if thisNonElementmaps to text in XML, without any attribute nor child elements.Iterator<CClassInfo>listSubclasses()Enumerates all the sub-classes of this class.CClassInfoParentparent()voidsetAbstract()Marks this element as an abstract element.voidsetBaseClass(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.voidsetOrdered(boolean value)voidsetUserSpecifiedImplClass(String implClass)StringtoString()JClasstoType(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()
Description copied from interface:ClassInfoReturns 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:
hasAttributeWildcardin interfaceClassInfo<NType,NClass>- See Also:
ClassInfo.inheritsAttributeWildcard()
-
hasAttributeWildcard
public void hasAttributeWildcard(boolean hasAttributeWildcard)
-
hasSubClasses
public boolean hasSubClasses()
Description copied from interface:ClassInfoTrue if there's a known sub-type of this class inTypeInfoSet.- Specified by:
hasSubClassesin interfaceClassInfo<NType,NClass>
-
declaresAttributeWildcard
public boolean declaresAttributeWildcard()
Returns true if a new attribute wildcard property needs to be declared on this class.- Specified by:
declaresAttributeWildcardin interfaceClassInfo<NType,NClass>
-
inheritsAttributeWildcard
public boolean inheritsAttributeWildcard()
Returns true if this class inherits a wildcard attribute property from its ancestor classes.- Specified by:
inheritsAttributeWildcardin interfaceClassInfo<NType,NClass>
-
getClazz
public NClass getClazz()
Description copied from interface:ClassInfoGets the declaration this object is wrapping.
-
getScope
public CClassInfo getScope()
Description copied from interface:ElementIf non-null, this element is only active inside the given scope.
-
getName
public String getName()
Description copied from interface:ClassInfoGets the fully-qualified name of the class.
-
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:
getPropertiesin interfaceClassInfo<NType,NClass>- Returns:
- always non-null, but can be empty.
-
hasValueProperty
public boolean hasValueProperty()
Description copied from interface:ClassInfoReturns true if this class or its ancestor hasXmlValueproperty.- Specified by:
hasValuePropertyin interfaceClassInfo<NType,NClass>
-
getProperty
public CPropertyInfo getProperty(String name)
Gets a propery by name.- Specified by:
getPropertyin interfaceClassInfo<NType,NClass>- Returns:
- null if the property was not found.
- See Also:
PropertyInfo.getName()
-
hasProperties
public boolean hasProperties()
Description copied from interface:ClassInfoIf the class has properties, return true. This is only true if the Collection object returned byClassInfo.getProperties()is not empty.- Specified by:
hasPropertiesin interfaceClassInfo<NType,NClass>
-
isElement
public boolean isElement()
Description copied from interface:MaybeElementIf 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:
isElementin interfaceMaybeElement<NType,NClass>
-
getInfo
@Deprecated public CNonElement getInfo()
Deprecated.Guaranteed to return this.- Specified by:
getInfoin interfaceCNonElement- Specified by:
getInfoin interfaceTypeUse
-
asElement
public Element<NType,NClass> asElement()
Description copied from interface:MaybeElement- Specified by:
asElementin interfaceMaybeElement<NType,NClass>- Returns:
- null if
MaybeElement.isElement()==false, non-null ifMaybeElement.isElement()==true.
-
isOrdered
public boolean isOrdered()
Description copied from interface:ClassInfoReturns 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
@Deprecated public boolean isFinal()
Deprecated.if you are calling this method directly, you must be doing something wrong.Description copied from interface:ClassInfoIf this class is marked as final and no further extension/restriction is allowed.
-
setOrdered
public void setOrdered(boolean value)
-
getElementName
public QName getElementName()
Description copied from interface:MaybeElementGets the element name of the class, if the class is bound to an element.- Specified by:
getElementNamein interfaceElement<NType,NClass>- Specified by:
getElementNamein interfaceMaybeElement<NType,NClass>- Returns:
- non-null iff
MaybeElement.isElement().
-
getTypeName
public QName getTypeName()
Description copied from interface:NonElementGets 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:
getTypeNamein 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:NonElementReturns true if thisNonElementmaps to text in XML, without any attribute nor child elements.- Specified by:
isSimpleTypein interfaceNonElement<NType,NClass>
-
fullName
public String fullName()
Returns the FQCN of this bean.- Specified by:
fullNamein interfaceCClassInfoParent- Specified by:
fullNamein 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 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
public CClassInfo getBaseClass()
This inherited version returns null if this class extends fromCClassRef.- Specified by:
getBaseClassin interfaceClassInfo<NType,NClass>- Returns:
- null
if this info extends from
Object. - See Also:
getRefBaseClass()
-
getRefBaseClass
public CClassRef getRefBaseClass()
-
listSubclasses
public Iterator<CClassInfo> listSubclasses()
Enumerates all the sub-classes of this class.
-
getSubstitutionHead
public CClassInfo getSubstitutionHead()
Description copied from interface:ElementIf this element can substitute another element, return that element.Substitutability of elements are transitive.
- Specified by:
getSubstitutionHeadin interfaceElement<NType,NClass>- Returns:
- null if no such element exists.
-
_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 final <T> T accept(CClassInfoParent.Visitor<T> visitor)
- Specified by:
acceptin interfaceCClassInfoParent
-
getOwnerPackage
public JPackage getOwnerPackage()
Description copied from interface:CClassInfoParentGets the nearestJPackage.- Specified by:
getOwnerPackagein interfaceCClassInfoParent
-
getType
public final NClass getType()
Description copied from interface:TypeInfoGets the underlying Java type that object represents.
-
toType
public final JClass toType(Outline o, Aspect aspect)
Description copied from interface:CTypeInfo- Specified by:
toTypein interfaceCTypeInfo- Specified by:
toTypein interfaceNClass- Specified by:
toTypein interfaceNTypeaspect- 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:NTypeReturns true iff this type represents a class that has a unboxed form. For example, forStringthis is false, but forIntegerthis is true.- Specified by:
isBoxedTypein interfaceNType
-
getLocator
public Locator getLocator()
Description copied from interface:CCustomizableGets the source location in the schema from which this model component is created.- Specified by:
getLocatorin interfaceCCustomizable- Returns:
- never null.
-
isAbstract
public boolean isAbstract()
Description copied from interface:CElementReturns true iff this element is an abstract element.- Specified by:
isAbstractin interfaceCElement
-
setAbstract
public void setAbstract()
Description copied from interface:CElementMarks this element as an abstract element.- Specified by:
setAbstractin 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:CCustomizableIf this model object is built from XML Schema, this property returns a schema component from which the model is built.- Specified by:
getSchemaComponentin 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?Description copied from interface:TypeInfoTrue if this type is a valid target from a property annotated withXmlIDREF.- Specified by:
canBeReferencedByIDREFin interfaceTypeInfo<NType,NClass>
-
getExpectedMimeType
public jakarta.activation.MimeType getExpectedMimeType()
No defaultMimeType.
-
getCustomizations
public CCustomizations getCustomizations()
Description copied from interface:CCustomizableGets the list of customizations attached to this model component.- Specified by:
getCustomizationsin 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()
Description copied from interface:LocatableGets the upstreamLocationinformation.- Specified by:
getUpstreamin interfaceLocatable- Returns:
- can be null.
-
getLocation
public final Location getLocation()
Description copied from interface:LocatableGets the location object that this object points to. This operation could be inefficient and costly.- Specified by:
getLocationin interfaceLocatable
-
-