For performance reasons, the actual list object used to store data is lazily created.
| Modifier and Type | Class and Description |
|---|---|
| protected abstract class |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | eagerInstanciation
True to create a new instance of List eagerly in the constructor. |
| protected JFieldVar | field
The field that stores the list. |
| private JMethod | internalGetter
a method that lazily initializes a List. |
| protected final JClass | |
| protected final JPrimitiveType | primitiveType
If this collection property is a collection of a primitive type, this variable refers to that primitive type. |
| Access | Constructor and Description |
|---|---|
| protected | AbstractListField(ClassOutlineImpl outline, CPropertyInfo prop, boolean eagerInstanciation)
Call |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected final void | fixNullRef(JBlock block)
Generates statement(s) so that the successive |
| protected final void | |
| protected abstract void | |
| private void | |
| protected abstract JClass | |
| public JType | getRawType()
Implements com. Gets the type of the "raw value". |
| private JExpression |
| eagerInstanciation | back to summary |
|---|---|
| private final boolean eagerInstanciation True to create a new instance of List eagerly in the constructor. False otherwise. Setting it to true makes the generated code slower (as more list instances need to be allocated), but it works correctly if the user specifies the custom type of a list. | |
| field | back to summary |
|---|---|
| protected JFieldVar field The field that stores the list. | |
| internalGetter | back to summary |
|---|---|
| private JMethod internalGetter a method that lazily initializes a List. Lazily created. [RESULT] List _getFoo() { if(field==null) field = create new list; return field; } | |
| listT | back to summary |
|---|---|
| protected final JClass listT | |
| primitiveType | back to summary |
|---|---|
| protected final JPrimitiveType primitiveType If this collection property is a collection of a primitive type, this variable refers to that primitive type. Otherwise null. | |
| AbstractListField | back to summary |
|---|---|
| protected AbstractListField(ClassOutlineImpl outline, CPropertyInfo prop, boolean eagerInstanciation) Call | |
| appendJavadoc | back to summary |
|---|---|
| protected void appendJavadoc(MethodWriter writer) | |
| fixNullRef | back to summary |
|---|---|
| protected final void fixNullRef(JBlock block) Generates statement(s) so that the successive | |
| generate | back to summary |
|---|---|
| protected final void generate() | |
| generateAccessors | back to summary |
|---|---|
| protected abstract void generateAccessors() Generates accessor methods. | |
| generateInternalGetter | back to summary |
|---|---|
| private void generateInternalGetter() | |
| getCoreListType | back to summary |
|---|---|
| protected abstract JClass getCoreListType() Concrete class that implements the List interface. Used as the actual data storage. | |
| getRawType | back to summary |
|---|---|
| public JType getRawType() Implements com. Doc from com. 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.
| |
| newCoreList | back to summary |
|---|---|
| private JExpression newCoreList() | |
| Modifier and Type | Field and Description |
|---|---|
| protected final JFieldRef | field
Reference to the |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected final JExpression | |
| public JExpression | |
| public JExpression | hasSetValue()
Implements com. Return an expression that evaluates to true only when this field has a set value(s). |
| protected final JExpression | ref(boolean
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. canBeNull)Returns a reference to the List field that stores the data. |
| protected final JExpression | |
| public void | unsetValues(JBlock body)
Implements com. Generates a code fragment to remove any "set" value and move this field to the "unset" state. |
| field | back to summary |
|---|---|
| protected final JFieldRef field Reference to the | |
| Accessor | back to summary |
|---|---|
| protected Accessor(JExpression $target) | |
| box | back to summary |
|---|---|
| protected final JExpression box(JExpression exp) | |
| count | back to summary |
|---|---|
| public JExpression count() | |
| hasSetValue | back to summary |
|---|---|
| public JExpression hasSetValue() Implements com. Doc from com. Return an expression that evaluates to true only when this field has a set value(s).
| |
| ref | back to summary |
|---|---|
| protected final 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.
| |
| unbox | back to summary |
|---|---|
| protected final JExpression unbox(JExpression exp) | |
| unsetValues | back to summary |
|---|---|
| public void unsetValues(JBlock body) Implements com. Doc from com. Generates a code fragment to remove any "set" value and move this field to the "unset" state.
| |