org.jvnet.hyperjaxb3.xjc.generator.bean.field
Class UntypedListField

java.lang.Object
  extended by org.jvnet.hyperjaxb3.xjc.generator.bean.field.AbstractField
      extended by org.jvnet.hyperjaxb3.xjc.generator.bean.field.UntypedListField
All Implemented Interfaces:
com.sun.tools.xjc.outline.FieldOutline
Direct Known Subclasses:
UntypedSettableListField

public class UntypedListField
extends AbstractField

Realizes a property as an untyped List.

 List getXXX();
 

Default value handling

Since unmarshaller just adds new values into the storage, we can't fill the storage by default values at the time of instanciation. (or oherwise values found in the document will be appended to default values, where it should overwrite them.)

Therefore, when the object is created, the storage will be empty. When the getXXX method is called, we'll check if the storage is modified in anyway. If it is modified, it must mean that the values are found in the document, so we just return it. Otherwise we will fill in default values and return it to the user.

When a list has default values, its dirty flag is set to true. Marshaller will check this and treat it appropriately.

Author:
Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)

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 org.jvnet.hyperjaxb3.xjc.generator.bean.field.AbstractField
codeModel, exposedType, implType, outline, prop
 
Constructor Summary
protected UntypedListField(com.sun.tools.xjc.generator.bean.ClassOutlineImpl context, com.sun.tools.xjc.model.CPropertyInfo prop, com.sun.codemodel.JClass coreList)
           
 
Method Summary
 org.jvnet.hyperjaxb3.xjc.generator.bean.field.UntypedListField.Accessor create(com.sun.codemodel.JExpression targetObject)
           
protected  void fixNullRef(com.sun.codemodel.JBlock block)
          Generates statement(s) so that the successive Accessor#ref(boolean) with true will always return a non-null list.
protected  void generate()
           
 void generateAccessors()
          Generates accessor methods.
protected  com.sun.codemodel.JClass getCoreListType()
          Concrete class that implements the List interface.
 com.sun.codemodel.JType getRawType()
           
 
Methods inherited from class org.jvnet.hyperjaxb3.xjc.generator.bean.field.AbstractField
annotate, castToImplType, generateField, getPropertyInfo, getType, getType, listPossibleTypes, parent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

UntypedListField

protected UntypedListField(com.sun.tools.xjc.generator.bean.ClassOutlineImpl context,
                           com.sun.tools.xjc.model.CPropertyInfo prop,
                           com.sun.codemodel.JClass coreList)
Parameters:
coreList - A concrete class that implements the List interface. An instance of this class will be used to store data for this field.
Method Detail

getCoreListType

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


generateAccessors

public void generateAccessors()
Generates accessor methods.


create

public org.jvnet.hyperjaxb3.xjc.generator.bean.field.UntypedListField.Accessor create(com.sun.codemodel.JExpression targetObject)

generate

protected final void generate()

fixNullRef

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


getRawType

public final com.sun.codemodel.JType getRawType()


Copyright © 2005-2011. All Rights Reserved.