Top Description Fields Constructors Methods
com.sun.tools.xjc.model

public final Class CClassInfo

extends AbstractCElement
implements ClassInfo<NType, NClass>, CClassInfoParent, CClass, NClass
Class Inheritance
All Implemented Interfaces
com.sun.tools.xjc.model.nav.NClass, com.sun.tools.xjc.model.nav.NType, com.sun.tools.xjc.model.CClass, com.sun.tools.xjc.model.CElement, org.glassfish.jaxb.core.v2.model.core.Element, org.glassfish.jaxb.core.v2.model.core.TypeInfo, org.glassfish.jaxb.core.v2.model.annotation.Locatable, com.sun.tools.xjc.model.CTypeInfo, com.sun.tools.xjc.model.CCustomizable, com.sun.tools.xjc.model.CNonElement, com.sun.tools.xjc.model.TypeUse, org.glassfish.jaxb.core.v2.model.core.NonElement, com.sun.tools.xjc.model.CClassInfoParent, org.glassfish.jaxb.core.v2.model.core.ClassInfo, org.glassfish.jaxb.core.v2.model.core.MaybeElement
Imports
java.util.ArrayList, .Collection, .HashSet, .Iterator, .List, .Set, jakarta.xml.bind.annotation.XmlElement, .XmlID, .XmlIDREF, .XmlRootElement, javax.xml.namespace.QName, com.sun.codemodel.JClass, .JCodeModel, .JPackage, com.sun.istack.Nullable, com.sun.tools.xjc.Language, com.sun.tools.xjc.model.nav.NClass, .NType, com.sun.tools.xjc.outline.Aspect, .Outline, com.sun.tools.xjc.reader.Ring, com.sun.tools.xjc.reader.xmlschema.BGMBuilder, com.sun.tools.xjc.reader.xmlschema.bindinfo.BIFactoryMethod, org.glassfish.jaxb.core.v2.model.core.ClassInfo, .Element, com.sun.xml.xsom.ForeignAttributes, .XSComponent, org.xml.sax.Locator

Mutable ClassInfo representation.

Schema parsers build these objects.

Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
private Set<JClass>
_implements

Interfaces to be implemented.

private CClass
private static final CClassInfoParent.Visitor<String>
private final List<Constructor>
constructors

Constructor declarations.

private final QName
elementName

If this class also gets XmlRootElement, the class name.

private CClassInfo
firstSubclass

List of all subclasses, together with nextSibling.

private boolean
private String
implClass

Optional user-specified implementation override class.

private boolean
public String
javadoc

Todo

revisit this design.

public final Model
model

The Model object to which this bean belongs.

private CClassInfo
private final CClassInfoParent
private final List<CPropertyInfo>
public final String
shortName

short name.

private String
squeezedName

Custom squeezed name, if any.

private final QName

Constructor Summary

AccessConstructor and Description
public
CClassInfo(Model model, JPackage pkg, String shortName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations)

public
CClassInfo(Model model, CClassInfoParent p, String shortName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations)

public
CClassInfo(Model model, JCodeModel cm, String fullName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations)

Method Summary

Modifier and TypeMethod and Description
public void
public <T> T
public void
addConstructor(String... fieldNames)

Creates a new constructor declaration and adds it.

public void
addProperty(CPropertyInfo prop)

Adds a new property.

public Element<NType, NClass>
public boolean
declaresAttributeWildcard()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.declaresAttributeWildcard.

Returns true if a new attribute wildcard property needs to be declared on this class.

public String
public CClassInfo
getBaseClass()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.getBaseClass.

This inherited version returns null if this class extends from CClassRef.

public NClass
getClazz()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.getClazz.

Gets the declaration this object is wrapping.

public Collection<? extends Constructor>
getConstructors()

list all constructor declarations.

public QName
public CNonElement
getInfo()

Implements com.sun.tools.xjc.model.CNonElement.getInfo.

Deprecated

Guaranteed to return this.

public String
getName()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.getName.

Gets the fully-qualified name of the class.

public JPackage
public List<CPropertyInfo>
public CPropertyInfo
public CClassRef
public CClassInfo
getScope()

Implements org.glassfish.jaxb.core.v2.model.core.Element.getScope.

If non-null, this element is only active inside the given scope.

public String
getSqueezedName()

Returns the "squeezed name" of this bean token.

public CClassInfo
getSubstitutionHead()

Implements org.glassfish.jaxb.core.v2.model.core.Element.getSubstitutionHead.

If this element can substitute another element, return that element.

public NClass
getType()

Implements org.glassfish.jaxb.core.v2.model.core.TypeInfo.getType.

Gets the underlying Java type that object represents.

public QName
getTypeName()

Implements org.glassfish.jaxb.core.v2.model.core.NonElement.getTypeName.

Gets the primary XML type ANYTYPE_NAME of the class.

public String
public boolean
hasAttributeWildcard()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.hasAttributeWildcard.

Returns true if this bean class has an attribute wildcard.

public void
hasAttributeWildcard(boolean hasAttributeWildcard)

public boolean
hasProperties()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.hasProperties.

If the class has properties, return true.

public boolean
hasSubClasses()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.hasSubClasses.

True if there's a known sub-type of this class in TypeInfoSet.

public boolean
hasValueProperty()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.hasValueProperty.

Returns true if this class or its ancestor has XmlValue property.

public boolean
inheritsAttributeWildcard()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.inheritsAttributeWildcard.

Returns true if this class inherits a wildcard attribute property from its ancestor classes.

public boolean
isBoxedType()

Implements com.sun.tools.xjc.model.nav.NType.isBoxedType.

Returns true iff this type represents a class that has a unboxed form.

public boolean
isElement()

Implements org.glassfish.jaxb.core.v2.model.core.MaybeElement.isElement.

If the class is bound to an element, return true.

public boolean
isFinal()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.isFinal.

Deprecated if you are calling this method directly, you must be doing something wrong.

If this class is marked as final and no further extension/restriction is allowed.

public boolean
isOrdered()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.isOrdered.

Returns true if the properties of this class is ordered in XML.

public boolean
isSimpleType()

Implements org.glassfish.jaxb.core.v2.model.core.NonElement.isSimpleType.

Returns true if this maps to text in XML, without any attribute nor child elements.

public Iterator<CClassInfo>
listSubclasses()

Enumerates all the sub-classes of this class.

public CClassInfoParent
public void
setBaseClass(CClass base)

This method accepts both (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.

public void
setOrdered(boolean value)

public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public JClass
toType(Outline o, Aspect aspect)

Implements com.sun.tools.xjc.model.CTypeInfo.toType, com.sun.tools.xjc.model.nav.NClass.toType.

Returns the JClass that represents the class being bound, under the given Outline.

Inherited from com.sun.tools.xjc.model.AbstractCElement:
getLocatorisAbstractsetAbstract

Field Detail

_implementsback to summary
private Set<JClass> _implements

Interfaces to be implemented. Lazily constructed.

baseClassback to summary
private CClass baseClass
Annotations
@XmlIDREF
calcSqueezedNameback to summary
private static final CClassInfoParent.Visitor<String> calcSqueezedName
constructorsback to summary
private final List<Constructor> constructors

Constructor declarations. array of Constructors.

elementNameback to summary
private final QName elementName

If this class also gets XmlRootElement, the class name.

Annotations
@Nullable
firstSubclassback to summary
private CClassInfo firstSubclass

List of all subclasses, together with nextSibling. If this class has no sub-class, this field is null. Otherwise, this field points to a sub-class of this class. From there you can enumerate all the sub-classes by using nextSibling.

hasAttributeWildcardback to summary
private boolean hasAttributeWildcard
See Also
hasAttributeWildcard()
implClassback to summary
private String implClass

Optional user-specified implementation override class.

Annotations
@Nullable
isOrderedback to summary
private boolean isOrdered
javadocback to summary
public 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.

modelback to summary
public final Model model

The Model object to which this bean belongs.

nextSiblingback to summary
private CClassInfo nextSibling
See Also
firstSubclass
parentback to summary
private final CClassInfoParent parent
Annotations
@XmlIDREF
propertiesback to summary
private final List<CPropertyInfo> properties
shortNameback to summary
public final String shortName

short name.

squeezedNameback to summary
private String squeezedName

Custom squeezed name, if any.

Annotations
@Nullable
typeNameback to summary
private final QName typeName
See Also
getTypeName()

Constructor Detail

CClassInfoback to summary
public CClassInfo(Model model, JPackage pkg, String shortName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations)
CClassInfoback to summary
public CClassInfo(Model model, CClassInfoParent p, String shortName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations)
CClassInfoback to summary
public CClassInfo(Model model, JCodeModel cm, String fullName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations)

Method Detail

_implementsback to summary
public void _implements(JClass c)
acceptback to summary
public <T> T accept(CClassInfoParent.Visitor<T> visitor)

Implements com.sun.tools.xjc.model.CClassInfoParent.accept.

Annotations
@Override
addConstructorback to summary
public void addConstructor(String... fieldNames)

Creates a new constructor declaration and adds it.

addPropertyback to summary
public void addProperty(CPropertyInfo prop)

Adds a new property.

asElementback to summary
public Element<NType, NClass> asElement()

Implements org.glassfish.jaxb.core.v2.model.core.MaybeElement.asElement.

Doc from org.glassfish.jaxb.core.v2.model.core.MaybeElement.asElement.

Returns the Element aspect of this ClassInfo.

Annotations
@Override
declaresAttributeWildcardback to summary
public boolean declaresAttributeWildcard()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.declaresAttributeWildcard.

Returns true if a new attribute wildcard property needs to be declared on this class.

Annotations
@Override
fullNameback to summary
public String fullName()

Implements com.sun.tools.xjc.model.CClassInfoParent.fullName, com.sun.tools.xjc.model.nav.NType.fullName.

Returns the FQCN of this bean.

Annotations
@Override
getBaseClassback to summary
public CClassInfo getBaseClass()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.getBaseClass.

This inherited version returns null if this class extends from CClassRef.

Annotations
@Override
See Also
getRefBaseClass()
getClazzback to summary
public NClass getClazz()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.getClazz.

Doc from org.glassfish.jaxb.core.v2.model.core.ClassInfo.getClazz.

Gets the declaration this object is wrapping.

Annotations
@Override
getConstructorsback to summary
public Collection<? extends Constructor> getConstructors()

list all constructor declarations.

getElementNameback to summary
public QName getElementName()

Implements org.glassfish.jaxb.core.v2.model.core.MaybeElement.getElementName, org.glassfish.jaxb.core.v2.model.core.Element.getElementName.

Doc from org.glassfish.jaxb.core.v2.model.core.MaybeElement.getElementName.

Gets the element name of the class, if the class is bound to an element.

Annotations
@Override
getInfoback to summary
public CNonElement getInfo()

Implements com.sun.tools.xjc.model.CNonElement.getInfo.

Deprecated

Guaranteed to return this.

Annotations
@Deprecated
@Override
getNameback to summary
public String getName()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.getName.

Doc from org.glassfish.jaxb.core.v2.model.core.ClassInfo.getName.

Gets the fully-qualified name of the class.

Annotations
@XmlID
@Override
getOwnerPackageback to summary
public JPackage getOwnerPackage()

Implements com.sun.tools.xjc.model.CClassInfoParent.getOwnerPackage.

Doc from com.sun.tools.xjc.model.CClassInfoParent.getOwnerPackage.

Gets the nearest JPackage.

Annotations
@Override
getPropertiesback to summary
public List<CPropertyInfo> getProperties()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.getProperties.

Returns a mutable list.

Annotations
@Override
getPropertyback to summary
public CPropertyInfo getProperty(String name)

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.getProperty.

Gets a propery by name.

Annotations
@Override
getRefBaseClassback to summary
public CClassRef getRefBaseClass()
getScopeback to summary
public CClassInfo getScope()

Implements org.glassfish.jaxb.core.v2.model.core.Element.getScope.

Doc from org.glassfish.jaxb.core.v2.model.core.Element.getScope.

If non-null, this element is only active inside the given scope.

Annotations
@Override
getSqueezedNameback to summary
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

Annotations
@XmlElement
getSubstitutionHeadback to summary
public CClassInfo getSubstitutionHead()

Implements org.glassfish.jaxb.core.v2.model.core.Element.getSubstitutionHead.

Doc from org.glassfish.jaxb.core.v2.model.core.Element.getSubstitutionHead.

If this element can substitute another element, return that element.

Substitutability of elements are transitive.

Annotations
@Override
getTypeback to summary
public NClass getType()

Implements org.glassfish.jaxb.core.v2.model.core.TypeInfo.getType.

Doc from org.glassfish.jaxb.core.v2.model.core.TypeInfo.getType.

Gets the underlying Java type that object represents.

Annotations
@Override
getTypeNameback to summary
public QName getTypeName()

Implements org.glassfish.jaxb.core.v2.model.core.NonElement.getTypeName.

Doc from org.glassfish.jaxb.core.v2.model.core.NonElement.getTypeName.

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.

Annotations
@Override
getUserSpecifiedImplClassback to summary
public String getUserSpecifiedImplClass()
hasAttributeWildcardback to summary
public boolean hasAttributeWildcard()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.hasAttributeWildcard.

Doc from org.glassfish.jaxb.core.v2.model.core.ClassInfo.hasAttributeWildcard.

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.

Annotations
@Override
hasAttributeWildcardback to summary
public void hasAttributeWildcard(boolean hasAttributeWildcard)
hasPropertiesback to summary
public boolean hasProperties()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.hasProperties.

Doc from org.glassfish.jaxb.core.v2.model.core.ClassInfo.hasProperties.

If the class has properties, return true. This is only true if the Collection object returned by getProperties() is not empty.

Annotations
@Override
hasSubClassesback to summary
public boolean hasSubClasses()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.hasSubClasses.

Doc from org.glassfish.jaxb.core.v2.model.core.ClassInfo.hasSubClasses.

True if there's a known sub-type of this class in TypeInfoSet.

Annotations
@Override
hasValuePropertyback to summary
public boolean hasValueProperty()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.hasValueProperty.

Doc from org.glassfish.jaxb.core.v2.model.core.ClassInfo.hasValueProperty.

Returns true if this class or its ancestor has XmlValue property.

Annotations
@Override
inheritsAttributeWildcardback to summary
public boolean inheritsAttributeWildcard()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.inheritsAttributeWildcard.

Returns true if this class inherits a wildcard attribute property from its ancestor classes.

Annotations
@Override
isBoxedTypeback to summary
public boolean isBoxedType()

Implements com.sun.tools.xjc.model.nav.NType.isBoxedType.

Doc from com.sun.tools.xjc.model.nav.NType.isBoxedType.

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.

Annotations
@Override
isElementback to summary
public boolean isElement()

Implements org.glassfish.jaxb.core.v2.model.core.MaybeElement.isElement.

Doc from org.glassfish.jaxb.core.v2.model.core.MaybeElement.isElement.

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.

Annotations
@Override
isFinalback to summary
public boolean isFinal()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.isFinal.

Doc from org.glassfish.jaxb.core.v2.model.core.ClassInfo.isFinal.

Deprecated

if you are calling this method directly, you must be doing something wrong.

If this class is marked as final and no further extension/restriction is allowed.

Annotations
@Deprecated
@Override
isOrderedback to summary
public boolean isOrdered()

Implements org.glassfish.jaxb.core.v2.model.core.ClassInfo.isOrdered.

Doc from org.glassfish.jaxb.core.v2.model.core.ClassInfo.isOrdered.

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

Annotations
@Override
isSimpleTypeback to summary
public boolean isSimpleType()

Implements org.glassfish.jaxb.core.v2.model.core.NonElement.isSimpleType.

Doc from org.glassfish.jaxb.core.v2.model.core.NonElement.isSimpleType.

Returns true if this maps to text in XML, without any attribute nor child elements.

Annotations
@Override
listSubclassesback to summary
public Iterator<CClassInfo> listSubclasses()

Enumerates all the sub-classes of this class.

parentback to summary
public CClassInfoParent parent()
setBaseClassback to summary
public void setBaseClass(CClass base)

This method accepts both (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.

setOrderedback to summary
public void setOrdered(boolean value)
setUserSpecifiedImplClassback to summary
public void setUserSpecifiedImplClass(String implClass)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
toTypeback to summary
public JClass toType(Outline o, Aspect aspect)

Implements com.sun.tools.xjc.model.CTypeInfo.toType, com.sun.tools.xjc.model.nav.NClass.toType.

Doc from com.sun.tools.xjc.model.CTypeInfo.toType.

Returns the JClass that represents the class being bound, under the given Outline.

Annotations
@Override