com.sun.tools.xjc.generator.bean.field
Class AbstractListField.Accessor

java.lang.Object
  extended by com.sun.tools.xjc.generator.bean.field.AbstractField.Accessor
      extended by com.sun.tools.xjc.generator.bean.field.AbstractListField.Accessor
All Implemented Interfaces:
FieldAccessor
Direct Known Subclasses:
ArrayField.Accessor, UntypedListField.Accessor
Enclosing class:
AbstractListField

protected abstract class AbstractListField.Accessor
extends AbstractField.Accessor


Field Summary
protected  com.sun.codemodel.JFieldRef field
          Reference to the AbstractListField.field of the target object.
 
Fields inherited from class com.sun.tools.xjc.generator.bean.field.AbstractField.Accessor
$target
 
Constructor Summary
protected AbstractListField.Accessor(com.sun.codemodel.JExpression $target)
           
 
Method Summary
 void add(com.sun.codemodel.JBlock body, com.sun.codemodel.JExpression newValue)
          Generate a code to add the "newValue" to this field and set it to the 'body'.
protected  com.sun.codemodel.JExpression box(com.sun.codemodel.JExpression exp)
           
 com.sun.codemodel.JExpression count()
           
 com.sun.codemodel.JExpression getContentValue()
          Get the "content" of this field in one object.
 com.sun.codemodel.JExpression hasSetValue()
          Return an expression that evaluates to true only when this field has a set value(s).
protected  com.sun.codemodel.JExpression ref(boolean canBeNull)
          Returns a reference to the List field that stores the data.
 void toArray(com.sun.codemodel.JBlock block, com.sun.codemodel.JExpression $array)
          Dumps everything in this field into the given array, which is guaranteed to have the enough space to store all the values (that is, the caller is responsible for ensuring the size of the array.) The type of the array must be the same as getPropertyInfo().getType().
protected  com.sun.codemodel.JExpression unbox(com.sun.codemodel.JExpression exp)
           
 void unsetValues(com.sun.codemodel.JBlock body)
          Generates a code fragment to remove any "set" value and move this field to the "unset" state.
 
Methods inherited from class com.sun.tools.xjc.generator.bean.field.AbstractField.Accessor
getPropertyInfo, owner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.tools.xjc.outline.FieldAccessor
fromRawValue, toRawValue
 

Field Detail

field

protected final com.sun.codemodel.JFieldRef field
Reference to the AbstractListField.field of the target object.

Constructor Detail

AbstractListField.Accessor

protected AbstractListField.Accessor(com.sun.codemodel.JExpression $target)
Method Detail

unbox

protected final com.sun.codemodel.JExpression unbox(com.sun.codemodel.JExpression exp)

box

protected final com.sun.codemodel.JExpression box(com.sun.codemodel.JExpression exp)

ref

protected final com.sun.codemodel.JExpression ref(boolean canBeNull)
Returns a reference to the List field that stores the data.

Using this method hides the fact that the list is lazily created.

Parameters:
canBeNull - if true, the returned expression may be null (this is when the list is still not constructed.) This could be useful when the caller can deal with null more efficiently. When the list is null, it should be treated as if the list is empty. if false, the returned expression will never be null. This is the behavior users would see.

add

public void add(com.sun.codemodel.JBlock body,
                com.sun.codemodel.JExpression newValue)
Description copied from interface: FieldAccessor
Generate a code to add the "newValue" to this field and set it to the 'body'.


toArray

public void toArray(com.sun.codemodel.JBlock block,
                    com.sun.codemodel.JExpression $array)
Description copied from interface: FieldAccessor
Dumps everything in this field into the given array, which is guaranteed to have the enough space to store all the values (that is, the caller is responsible for ensuring the size of the array.) The type of the array must be the same as getPropertyInfo().getType().


count

public com.sun.codemodel.JExpression count()

unsetValues

public void unsetValues(com.sun.codemodel.JBlock body)
Description copied from interface: FieldAccessor
Generates a code fragment to remove any "set" value and move this field to the "unset" state.

Parameters:
body - The code will be appended at the end of this block.

hasSetValue

public com.sun.codemodel.JExpression hasSetValue()
Description copied from interface: FieldAccessor
Return an expression that evaluates to true only when this field has a set value(s).

Returns:
null if the isSetXXX/unsetXXX method does not make sense for the given field.

getContentValue

public com.sun.codemodel.JExpression getContentValue()
Description copied from interface: FieldAccessor
Get the "content" of this field in one object. The type of this expression is the type returned by the getValueType method.

The notion of "content" is defined in the spec. Typically, it is a single Object that represents the field. For fields with a primitive value, this is a boxed type. For a list field, this is a List.

This object will be returned from the getContent method of the choice content interface.