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

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

abstract class AbstractListField
extends AbstractField

Common code for property renderer that generates a List as its underlying data structure.

For performance reasons, the actual list object used to store data is lazily created.


Nested Class Summary
protected  class AbstractListField.Accessor
           
 
Field Summary
protected  com.sun.codemodel.JFieldVar field
          The field that stores the list.
protected  com.sun.codemodel.JClass listT
           
protected  com.sun.codemodel.JPrimitiveType primitiveType
          If this collection property is a collection of a primitive type, this variable refers to that primitive type.
 
Fields inherited from class com.sun.tools.xjc.generator.bean.field.AbstractField
codeModel, exposedType, implType, outline, prop
 
Constructor Summary
protected AbstractListField(ClassOutlineImpl outline, CPropertyInfo prop, boolean eagerInstanciation)
          Call generate() method right after this.
 
Method Summary
protected  void fixNullRef(com.sun.codemodel.JBlock block)
          Generates statement(s) so that the successive AbstractListField.Accessor.ref(boolean) with true will always return a non-null list.
protected  void generate()
           
protected abstract  void generateAccessors()
          Generates accessor methods.
protected abstract  com.sun.codemodel.JClass getCoreListType()
          Concrete class that implements the List interface.
 com.sun.codemodel.JType getRawType()
          Gets the type of the "raw value".
 
Methods inherited from class com.sun.tools.xjc.generator.bean.field.AbstractField
annotate, castToImplType, generateField, getOptions, getPropertyInfo, getType, listPossibleTypes, parent
 
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.FieldOutline
create
 

Field Detail

field

protected com.sun.codemodel.JFieldVar field
The field that stores the list.


primitiveType

protected final com.sun.codemodel.JPrimitiveType primitiveType
If this collection property is a collection of a primitive type, this variable refers to that primitive type. Otherwise null.


listT

protected final com.sun.codemodel.JClass listT
Constructor Detail

AbstractListField

protected AbstractListField(ClassOutlineImpl outline,
                            CPropertyInfo prop,
                            boolean eagerInstanciation)
Call generate() method right after this.

Method Detail

generate

protected final void generate()

fixNullRef

protected final void fixNullRef(com.sun.codemodel.JBlock block)
Generates statement(s) so that the successive AbstractListField.Accessor.ref(boolean) with true will always return a non-null list. This is useful to avoid generating redundant internal getter.


getRawType

public com.sun.codemodel.JType getRawType()
Description copied from interface: FieldOutline
Gets the type of the "raw value".

This type can represent the entire value of this field. For fields that can carry multiple values, this is an array.

This type allows the client of the outline to generate code to set/get values from a property.


getCoreListType

protected abstract com.sun.codemodel.JClass getCoreListType()
Concrete class that implements the List interface. Used as the actual data storage.


generateAccessors

protected abstract void generateAccessors()
Generates accessor methods.