Top Description Inners Fields Constructors Methods
com.sun.tools.xjc.generator.bean.field

pack-priv abstract Class AbstractField

extends Object
implements FieldOutline
Class Inheritance
All Implemented Interfaces
com.sun.tools.xjc.outline.FieldOutline
Known Direct Subclasses
com.sun.tools.xjc.generator.bean.field.AbstractFieldWithVar, com.sun.tools.xjc.generator.bean.field.AbstractListField, com.sun.tools.xjc.generator.bean.field.ConstField, com.sun.tools.xjc.generator.bean.field.IsSetField
Imports
java.util.ArrayList, .Collection, .List, .Objects, jakarta.xml.bind.annotation.W3CDomHandler, .XmlList, .XmlMixed, .XmlNsForm, .XmlValue, .XmlInlineBinaryData, javax.xml.namespace.QName, com.sun.codemodel.JAnnotatable, .JClass, .JCodeModel, .JExpr, .JExpression, .JFieldVar, .JMod, .JType, com.sun.tools.xjc.generator.annotation.spec.XmlAnyElementWriter, .XmlAttributeWriter, .XmlElementRefWriter, .XmlElementRefsWriter, .XmlElementWriter, .XmlElementsWriter, .XmlSchemaTypeWriter, com.sun.tools.xjc.generator.bean.ClassOutlineImpl, com.sun.tools.xjc.model.CAttributePropertyInfo, .CElement, .CElementInfo, .CElementPropertyInfo, .CPropertyInfo, .CReferencePropertyInfo, .CTypeInfo, .CTypeRef, .CValuePropertyInfo, com.sun.tools.xjc.model.nav.NClass, com.sun.tools.xjc.outline.Aspect, .ClassOutline, .FieldAccessor, .FieldOutline, com.sun.tools.xjc.reader.TypeUtil, com.sun.tools.xjc.Options, org.glassfish.jaxb.core.api.impl.NameConverter, org.glassfish.jaxb.core.v2.TODO

Useful base class for implementing FieldOutline.

This class just provides a few utility methods and keep some important variables so that they can be readily accessed any time.

Author
Kohsuke Kawaguchi ([email protected])

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected abstract class
AbstractField.Accessor

Useful base class for implementing FieldAccessor.

Field Summary

Modifier and TypeField and Description
protected final JCodeModel
protected final JType
exposedType

The publicly visible type of this field.

protected final JType
implType

The type of this field, which can hold all the possible types.

protected final ClassOutlineImpl
protected final CPropertyInfo
private XmlElementsWriter

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected void
annotate(JAnnotatable field)

Annotate the field according to the recipes given as CPropertyInfo.

private void
annotateAttribute(JAnnotatable field)

Annotate the attribute property 'field'

private void
annotateElement(JAnnotatable field)

Annotate the element property 'field'

private void
protected final JExpression
castToImplType(JExpression exp)

Cast from exposedType to implType if necessary.

protected final JFieldVar
generateField(JType type)

Generates the field declaration.

protected final Options
getOptions()

Gets the Options in the current compilation context.

public final CPropertyInfo
getPropertyInfo()

Implements com.sun.tools.xjc.outline.FieldOutline.getPropertyInfo.

Gets the corresponding model object.

protected JType
getType(final Aspect aspect)

Compute the type of a CPropertyInfo

private XmlElementWriter
getXew(boolean checkWrapper, JAnnotatable field)

protected final List<Object>
listPossibleTypes(CPropertyInfo prop)

Returns contents to be added to javadoc.

public final ClassOutline
private JType
resolve(CTypeRef typeRef, Aspect a)

return the Java type for the given type reference in the model.

private void
writeXmlElementAnnotation(JAnnotatable field, CTypeRef ctype, JType jtype, boolean
true if the method might need to generate XmlElements
checkWrapper
)

Generate the simplest XmlElement annotation possible taking all semantic optimizations into account.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

codeModelback to summary
protected final JCodeModel codeModel
exposedTypeback to summary
protected final JType exposedType

The publicly visible type of this field. If we are generating value classes implType==exposedType.

implTypeback to summary
protected final JType implType

The type of this field, which can hold all the possible types.

outlineback to summary
protected final ClassOutlineImpl outline
propback to summary
protected final CPropertyInfo prop
xeswback to summary
private XmlElementsWriter xesw

Constructor Detail

AbstractFieldback to summary
protected AbstractField(ClassOutlineImpl outline, CPropertyInfo prop)

Method Detail

annotateback to summary
protected void annotate(JAnnotatable field)

Annotate the field according to the recipes given as CPropertyInfo.

annotateAttributeback to summary
private void annotateAttribute(JAnnotatable field)

Annotate the attribute property 'field'

annotateElementback to summary
private void annotateElement(JAnnotatable field)

Annotate the element property 'field'

annotateReferenceback to summary
private void annotateReference(JAnnotatable field)
castToImplTypeback to summary
protected final JExpression castToImplType(JExpression exp)

Cast from exposedType to implType if necessary.

generateFieldback to summary
protected final JFieldVar generateField(JType type)

Generates the field declaration.

getOptionsback to summary
protected final Options getOptions()

Gets the Options in the current compilation context.

getPropertyInfoback to summary
public final CPropertyInfo getPropertyInfo()

Implements com.sun.tools.xjc.outline.FieldOutline.getPropertyInfo.

Doc from com.sun.tools.xjc.outline.FieldOutline.getPropertyInfo.

Gets the corresponding model object.

Annotations
@Override
getTypeback to summary
protected JType getType(final Aspect aspect)

Compute the type of a CPropertyInfo

getXewback to summary
private XmlElementWriter getXew(boolean checkWrapper, JAnnotatable field)
listPossibleTypesback to summary
protected final List<Object> listPossibleTypes(CPropertyInfo prop)

Returns contents to be added to javadoc.

parentback to summary
public final ClassOutline parent()

Implements com.sun.tools.xjc.outline.FieldOutline.parent.

Doc from com.sun.tools.xjc.outline.FieldOutline.parent.

Gets the enclosing ClassOutline.

Annotations
@Override
resolveback to summary
private JType resolve(CTypeRef typeRef, Aspect a)

return the Java type for the given type reference in the model.

writeXmlElementAnnotationback to summary
private void writeXmlElementAnnotation(JAnnotatable field, CTypeRef ctype, JType jtype, boolean checkWrapper)

Generate the simplest XmlElement annotation possible taking all semantic optimizations into account. This method is essentially equivalent to: xew.name(ctype.getTagName().getLocalPart()) .namespace(ctype.getTagName().getNamespaceURI()) .type(jtype) .defaultValue(ctype.getDefaultValue());

Parameters
checkWrapper:boolean

true if the method might need to generate XmlElements

com.sun.tools.xjc.generator.bean.field back to summary

protected abstract Class AbstractField.Accessor

extends Object
implements FieldAccessor
Class Inheritance
  • java.lang.Object
  • com.sun.tools.xjc.generator.bean.field.AbstractField.Accessor
All Implemented Interfaces
com.sun.tools.xjc.outline.FieldAccessor
Known Direct Subclasses
com.sun.tools.xjc.generator.bean.field.AbstractFieldWithVar.Accessor, com.sun.tools.xjc.generator.bean.field.AbstractListField.Accessor, com.sun.tools.xjc.generator.bean.field.ConstField.Accessor, com.sun.tools.xjc.generator.bean.field.IsSetField.Accessor

Useful base class for implementing FieldAccessor.

Field Summary

Modifier and TypeField and Description
protected final JExpression
$target

Evaluates to the target object this accessor should access.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public final CPropertyInfo
getPropertyInfo()

Implements com.sun.tools.xjc.outline.FieldAccessor.getPropertyInfo.

Short for owner().getPropertyInfo()

public final FieldOutline
owner()

Implements com.sun.tools.xjc.outline.FieldAccessor.owner.

Gets the FieldOutline from which this object is created.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

$targetback to summary
protected final JExpression $target

Evaluates to the target object this accessor should access.

Constructor Detail

Accessorback to summary
protected Accessor(JExpression $target)

Method Detail

getPropertyInfoback to summary
public final CPropertyInfo getPropertyInfo()

Implements com.sun.tools.xjc.outline.FieldAccessor.getPropertyInfo.

Doc from com.sun.tools.xjc.outline.FieldAccessor.getPropertyInfo.

Short for owner().getPropertyInfo()

Annotations
@Override
ownerback to summary
public final FieldOutline owner()

Implements com.sun.tools.xjc.outline.FieldAccessor.owner.

Doc from com.sun.tools.xjc.outline.FieldAccessor.owner.

Gets the FieldOutline from which this object is created.

Annotations
@Override