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

public Class SingleField

extends AbstractFieldWithVar
Class Inheritance
Known Direct Subclasses
com.sun.tools.xjc.generator.bean.field.SinglePrimitiveAccessField
Imports
java.util.List, com.sun.codemodel.JBlock, .JConditional, .JExpr, .JExpression, .JMethod, .JType, .JVar, com.sun.tools.xjc.generator.bean.ClassOutlineImpl, .MethodWriter, com.sun.tools.xjc.model.CPropertyInfo, com.sun.tools.xjc.outline.FieldAccessor, org.glassfish.jaxb.core.api.impl.NameConverter

Realizes a property through one getter and one setter. This renders:
T' field;
T getXXX() { ... }
void setXXX(T value) { ... }

Normally T'=T, but under some tricky circumstances they could be different (like T'=Integer, T=int.) This realization is only applicable to fields with (1,1) or (0,1) multiplicity.

Author
Kohsuke Kawaguchi ([email protected])

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class

Constructor Summary

AccessConstructor and Description
protected
protected
SingleField(ClassOutlineImpl context, CPropertyInfo prop, boolean
forces the setter/getter to expose the primitive type. it's a pointless customization, but it's nevertheless in the spec.
forcePrimitiveAccess
)

Method Summary

Modifier and TypeMethod and Description
public FieldAccessor
create(JExpression targetObject)

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

Creates a new FieldAccessor of this field for the specified object.

public final JType
getFieldType()

Implements abstract com.sun.tools.xjc.generator.bean.field.AbstractFieldWithVar.getFieldType.

Returns the type used to store the value of the field in memory.

Inherited from com.sun.tools.xjc.generator.bean.field.AbstractFieldWithVar:
createFieldgetGetterMethodgetRawTyperef

Constructor Detail

SingleFieldback to summary
protected SingleField(ClassOutlineImpl context, CPropertyInfo prop)
SingleFieldback to summary
protected SingleField(ClassOutlineImpl context, CPropertyInfo prop, boolean forcePrimitiveAccess)
Parameters
forcePrimitiveAccess:boolean

forces the setter/getter to expose the primitive type. it's a pointless customization, but it's nevertheless in the spec.

Method Detail

createback to summary
public FieldAccessor create(JExpression targetObject)

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

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

Creates a new FieldAccessor of this field for the specified object.

Annotations
@Override
getFieldTypeback to summary
public final JType getFieldType()

Implements abstract com.sun.tools.xjc.generator.bean.field.AbstractFieldWithVar.getFieldType.

Doc from com.sun.tools.xjc.generator.bean.field.AbstractFieldWithVar.getFieldType.

Returns the type used to store the value of the field in memory.

Annotations
@Override
com.sun.tools.xjc.generator.bean.field back to summary

protected Class SingleField.Accessor

extends Accessor
Class Inheritance

Field Summary

Inherited from com.sun.tools.xjc.generator.bean.field.AbstractFieldWithVar.Accessor:
$ref

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public JExpression
hasSetValue()

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

Return an expression that evaluates to true only when this field has a set value(s).

public void
unsetValues(JBlock body)

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

Generates a code fragment to remove any "set" value and move this field to the "unset" state.

Inherited from com.sun.tools.xjc.generator.bean.field.AbstractFieldWithVar.Accessor:
fromRawValuetoRawValue

Constructor Detail

Accessorback to summary
protected Accessor(JExpression $target)

Method Detail

hasSetValueback to summary
public JExpression hasSetValue()

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

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

Return an expression that evaluates to true only when this field has a set value(s).

Annotations
@Override
unsetValuesback to summary
public void unsetValues(JBlock body)

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

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

Generates a code fragment to remove any "set" value and move this field to the "unset" state.

Annotations
@Override