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

public abstract Class CPropertyInfo

extends Object
implements PropertyInfo<NType, NClass>, CCustomizable
Class Inheritance
All Implemented Interfaces
com.sun.tools.xjc.model.CCustomizable, org.glassfish.jaxb.core.v2.model.core.PropertyInfo, org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource
Known Direct Subclasses
com.sun.tools.xjc.model.CReferencePropertyInfo, com.sun.tools.xjc.model.CSingleTypePropertyInfo, com.sun.tools.xjc.model.CElementPropertyInfo
Imports
java.lang.annotation.Annotation, java.util.Collection, .Map, javax.xml.XMLConstants, jakarta.xml.bind.annotation.XmlSchemaType, .XmlTransient, jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter, javax.xml.namespace.QName, com.sun.codemodel.JClass, .JJavaName, .JType, com.sun.tools.xjc.Plugin, com.sun.tools.xjc.generator.bean.field.FieldRenderer, com.sun.tools.xjc.model.nav.NClass, .NType, com.sun.tools.xjc.reader.Ring, org.glassfish.jaxb.core.api.impl.NameConverter, org.glassfish.jaxb.core.v2.model.core.PropertyInfo, org.glassfish.jaxb.core.v2.runtime.RuntimeUtil, com.sun.xml.xsom.XSComponent, org.xml.sax.ErrorHandler, .Locator

Model of a property to be generated.
Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
public JType
baseType

If the base type of the property is overriden, this field is set to non-null.

private final CCustomizations
public CDefaultValue
defaultValue

If non-null, keeps the default value in Java representation.

public boolean
private final boolean
public String
javadoc

Javadoc for this property.

public final Locator
private CClassInfo
private String
private String
public FieldRenderer
realization

Specifies how the field is generated by the backend.

private final XSComponent

Constructor Summary

AccessConstructor and Description
protected
CPropertyInfo(String name, boolean collection, XSComponent source, CCustomizations customizations, Locator locator)

Method Summary

Modifier and TypeMethod and Description
public abstract <V> V
public abstract <R, P> R
accept(CPropertyVisitor2<R, P> visitor, P p)

public QName

Returns:

null if no conflict was found. Otherwise return the QName that has the collision.
collectElementNames
(Map<QName, CPropertyInfo> table)

Puts the element names that this property possesses to the map, so that we can find two properties that own the same element name, which is an error.

public String
displayName()

Implements org.glassfish.jaxb.core.v2.model.core.PropertyInfo.displayName.

Gets the display name of the property.

public abstract CAdapter
public CCustomizations
getCustomizations()

Implements com.sun.tools.xjc.model.CCustomizable.getCustomizations.

Gets the list of customizations attached to this model component.

public Locator
getLocator()

Implements com.sun.tools.xjc.model.CCustomizable.getLocator.

Gets the source location in the schema from which this model component is created.

public String
getName()

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

Deprecated marked as deprecated so that we can spot the use of this method.

Name of the property.

public String
getName(boolean
if true, this method returns a name like "FooBar", which should be used as a seed for generating user-visible names (such as accessors like "getFooBar".)

if false, this method returns the "name of the property" as defined in the j2s side of the spec. This name is usually something like "fooBar", which often corresponds to the XML element/attribute name of this property (for taking advantage of annotation defaulting as much as possible)

isPublic
)

Gets the name of the property.

public final XSComponent

Returns:

null if the model is built from sources other than XML Schema (such as DTD.)
getSchemaComponent
()

Implements com.sun.tools.xjc.model.CCustomizable.getSchemaComponent.

If this model object is built from XML Schema, this property returns a schema component from which the model is built.

public final boolean
hasAnnotation(Class<? extends Annotation> annotationType)

Implements org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource.hasAnnotation.

Returns true if the property has the specified annotation.

public boolean
inlineBinaryData()

Implements org.glassfish.jaxb.core.v2.model.core.PropertyInfo.inlineBinaryData.

If this is true and this property indeed represents a binary data, it should be always inlined.

public boolean
isCollection()

Implements org.glassfish.jaxb.core.v2.model.core.PropertyInfo.isCollection.

Returns true if this is a multi-valued collection property.

public boolean
isOptionalPrimitive()

Returns true if this property needs to represent null just for the purpose of representing an absence of the property.

public boolean
isUnboxable()

Returns true if this property is "unboxable".

protected static boolean
needsExplicitTypeName(TypeUse type, QName typeName)

Checks if the given TypeUse would need an explicit XmlSchemaType annotation with the given type name.

public CTypeInfo
parent()

Implements org.glassfish.jaxb.core.v2.model.core.PropertyInfo.parent.

Gets the ClassInfo or ElementInfo to which this property belongs.

public final <A extends Annotation> A
readAnnotation(Class<A> annotationType)

Implements org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource.readAnnotation.

Gets the value of the specified annotation from the given property.

public abstract Collection<? extends CTypeInfo>
ref()

Redeclares org.glassfish.jaxb.core.v2.model.core.PropertyInfo.ref.

List of TypeInfos that this property references.

public void
setName(boolean isPublic, String newName)

Overrides the name of the property.

pack-priv final void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baseTypeback to summary
public JType baseType

If the base type of the property is overriden, this field is set to non-null.

customizationsback to summary
private final CCustomizations customizations
defaultValueback to summary
public CDefaultValue defaultValue

If non-null, keeps the default value in Java representation. If isCollection is true, this field is always null, for we don't handle default values for a list.

inlineBinaryDataback to summary
public boolean inlineBinaryData

Property annotated with jakarta.xml.bind.annotation.XmlInlineBinaryData.

isCollectionback to summary
private final boolean isCollection
javadocback to summary
public String javadoc

Javadoc for this property. Must not be null.

locatorback to summary
public final Locator locator
Annotations
@XmlTransient
parentback to summary
private CClassInfo parent
Annotations
@XmlTransient
privateNameback to summary
private String privateName
publicNameback to summary
private String publicName
realizationback to summary
public FieldRenderer realization

Specifies how the field is generated by the backend.

Annotations
@XmlJavaTypeAdapter:ToStringAdapter
sourceback to summary
private final XSComponent source
See Also
getSchemaComponent()

Constructor Detail

CPropertyInfoback to summary
protected CPropertyInfo(String name, boolean collection, XSComponent source, CCustomizations customizations, Locator locator)

Method Detail

acceptback to summary
public abstract <V> V accept(CPropertyVisitor<V> visitor)
acceptback to summary
public abstract <R, P> R accept(CPropertyVisitor2<R, P> visitor, P p)
collectElementNamesback to summary
public QName collectElementNames(Map<QName, CPropertyInfo> table)

Puts the element names that this property possesses to the map, so that we can find two properties that own the same element name, which is an error.

Returns:QName

null if no conflict was found. Otherwise return the QName that has the collision.

displayNameback to summary
public String displayName()

Implements org.glassfish.jaxb.core.v2.model.core.PropertyInfo.displayName.

Doc from org.glassfish.jaxb.core.v2.model.core.PropertyInfo.displayName.

Gets the display name of the property.

This is a convenience method for parent().getName()+'#'+getName().

Annotations
@Override
getAdapterback to summary
public abstract CAdapter getAdapter()

Redeclares org.glassfish.jaxb.core.v2.model.core.PropertyInfo.getAdapter.

Annotations
@Override
getCustomizationsback to summary
public CCustomizations getCustomizations()

Implements com.sun.tools.xjc.model.CCustomizable.getCustomizations.

Doc from com.sun.tools.xjc.model.CCustomizable.getCustomizations.

Gets the list of customizations attached to this model component.

Annotations
@Override
getLocatorback to summary
public Locator getLocator()

Implements com.sun.tools.xjc.model.CCustomizable.getLocator.

Doc from com.sun.tools.xjc.model.CCustomizable.getLocator.

Gets the source location in the schema from which this model component is created.

Annotations
@Override
getNameback to summary
public String getName()

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

Deprecated

marked as deprecated so that we can spot the use of this method.

Name of the property.

This method is implemented to follow the contract of , and therefore it always returns the name of the annotated field.

This name is normally not useful for the rest of XJC, which usually wants to access the "public name" of the property. A "public name" of the property is a name like "FooBar" which is used as a seed for generating the accessor methods. This is the name controlled by the schema customization via users.

If the caller is calling this method statically, it's usually the sign of a mistake. Use getName(boolean) method instead, which forces you to think about which name you want to get.

Annotations
@Deprecated
@Override
See Also
getName(boolean)
getNameback to summary
public String getName(boolean isPublic)

Gets the name of the property.

Parameters
isPublic:boolean

if true, this method returns a name like "FooBar", which should be used as a seed for generating user-visible names (such as accessors like "getFooBar".)

if false, this method returns the "name of the property" as defined in the j2s side of the spec. This name is usually something like "fooBar", which often corresponds to the XML element/attribute name of this property (for taking advantage of annotation defaulting as much as possible)

getSchemaComponentback to summary
public final XSComponent getSchemaComponent()

Implements com.sun.tools.xjc.model.CCustomizable.getSchemaComponent.

If this model object is built from XML Schema, this property returns a schema component from which the model is built.

Returns:XSComponent

null if the model is built from sources other than XML Schema (such as DTD.)

Annotations
@Override
hasAnnotationback to summary
public final boolean hasAnnotation(Class<? extends Annotation> annotationType)

Implements org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource.hasAnnotation.

Doc from org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource.hasAnnotation.

Returns true if the property has the specified annotation.

Short for readAnnotation(annotationType)!=null, but this method is typically faster.

Annotations
@Override
inlineBinaryDataback to summary
public boolean inlineBinaryData()

Implements org.glassfish.jaxb.core.v2.model.core.PropertyInfo.inlineBinaryData.

Doc from org.glassfish.jaxb.core.v2.model.core.PropertyInfo.inlineBinaryData.

If this is true and this property indeed represents a binary data, it should be always inlined.

Annotations
@Override
isCollectionback to summary
public boolean isCollection()

Implements org.glassfish.jaxb.core.v2.model.core.PropertyInfo.isCollection.

Doc from org.glassfish.jaxb.core.v2.model.core.PropertyInfo.isCollection.

Returns true if this is a multi-valued collection property. Otherwise false, in which case the property is a single value.

Annotations
@Override
isOptionalPrimitiveback to summary
public boolean isOptionalPrimitive()

Returns true if this property needs to represent null just for the purpose of representing an absence of the property.

isUnboxableback to summary
public boolean isUnboxable()

Returns true if this property is "unboxable".

In general, a property often has to be capable of representing null to indicate the absence of the value. This requires properties to be generated as @XmlElement Float f, not as @XmlElement float f;. But this is slow.

Fortunately, there are cases where we know that the property can never legally be absent. When this condition holds we can generate the optimized "unboxed form".

The exact such conditions depend on the kind of properties, so refer to the implementation code for the details.

This method returns true when the property can be generated as "unboxed form", false otherwise.

When this property is a collection, this method returns true if items in the collection is unboxable. Obviously, the collection itself is always a reference type.

needsExplicitTypeNameback to summary
protected static boolean needsExplicitTypeName(TypeUse type, QName typeName)

Checks if the given TypeUse would need an explicit XmlSchemaType annotation with the given type name.

parentback to summary
public CTypeInfo parent()

Implements org.glassfish.jaxb.core.v2.model.core.PropertyInfo.parent.

Doc from org.glassfish.jaxb.core.v2.model.core.PropertyInfo.parent.

Gets the ClassInfo or ElementInfo to which this property belongs.

Annotations
@Override
readAnnotationback to summary
public final <A extends Annotation> A readAnnotation(Class<A> annotationType)

Implements org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource.readAnnotation.

Doc from org.glassfish.jaxb.core.v2.model.annotation.AnnotationSource.readAnnotation.

Gets the value of the specified annotation from the given property.

When this method is used for a property that consists of a getter and setter, it returns the annotation on either of those methods. If both methods have the same annotation, it is an error.

Annotations
@Override
refback to summary
public abstract Collection<? extends CTypeInfo> ref()

Redeclares org.glassfish.jaxb.core.v2.model.core.PropertyInfo.ref.

Doc from org.glassfish.jaxb.core.v2.model.core.PropertyInfo.ref.

List of TypeInfos that this property references. This allows the caller to traverse the reference graph without getting into the details of each different property type.

Annotations
@Override
setNameback to summary
public void setName(boolean isPublic, String newName)

Overrides the name of the property. This method can be used from Plugin#postProcessModel(Model, ErrorHandler). But the caller should do so with the understanding that this is inherently dangerous method.

setParentback to summary
pack-priv final void setParent(CClassInfo parent)