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
protected  com.sun.codemodel.JExpression box(com.sun.codemodel.JExpression exp)
           
 com.sun.codemodel.JExpression count()
           
 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.
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.

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.