com.caucho.amber.field
Class PropertyField

java.lang.Object
  extended by com.caucho.amber.field.AbstractField
      extended by com.caucho.amber.field.PropertyField
All Implemented Interfaces:
AmberField
Direct Known Subclasses:
Discriminator, KeyPropertyField, VersionField

public class PropertyField
extends AbstractField

Configuration for a bean's field


Constructor Summary
PropertyField(AmberBeanType statefulType)
           
PropertyField(AmberBeanType statefulType, java.lang.String name)
           
 
Method Summary
 AmberExpr createExpr(QueryParser parser, PathExpr parent)
          Creates the expression for the field.
 void generateGetterMethod(JavaWriter out)
          Generates the set property.
 void generateInsertColumns(java.util.ArrayList<java.lang.String> columns)
          Generates the insert.
 void generateInsertSet(JavaWriter out, java.lang.String pstmt, java.lang.String index, java.lang.String obj)
          Generates the set clause for the insert clause.
 int generateLoad(JavaWriter out, java.lang.String rs, java.lang.String indexVar, int index)
          Generates loading code
 int generateLoadNative(JavaWriter out, int index)
          Generates loading code
 java.lang.String generateLoadSelect(AmberTable table, java.lang.String id)
          Generates the select clause.
 void generateNativeColumnNames(java.util.ArrayList<java.lang.String> names)
          Generates loading code
 java.lang.String generateNull()
          Returns the null value.
 java.lang.String generateSelect(java.lang.String id)
          Generates the select clause.
 void generateSetterMethod(JavaWriter out)
          Generates the set property.
 void generateStatementSet(JavaWriter out, java.lang.String pstmt, java.lang.String index, java.lang.String obj)
          Generates the set clause.
 void generateUpdate(CharBuffer sql)
          Generates the update set clause
 void generateUpdateSet(JavaWriter out, java.lang.String pstmt, java.lang.String index, java.lang.String obj)
          Generates the set clause for the insert clause.
 java.lang.String generateWhere(java.lang.String id)
          Generates the where clause.
 AmberColumn getColumn()
          Gets the column.
protected  java.lang.String getFieldName()
          Returns the field name.
 EntityType getRelatedSourceType()
          Returns the source type as entity or mapped-superclass.
 AmberTable getTable()
          Returns the table containing the field's columns.
 AmberType getType()
          Sets the result type.
 void init()
          Initializes the property.
 boolean isInsert()
           
 boolean isUpdate()
           
 AmberField override(AmberBeanType type)
          Creates a copy of the field for a parent
 void setColumn(AmberColumn column)
          Sets the column.
 void setInsert(boolean isInsert)
          Set true if the property should be saved on an insert.
 void setType(AmberType type)
          Sets the result type.
 void setUpdate(boolean isUpdate)
          Set true if the property should be saved on an update.
 
Methods inherited from class com.caucho.amber.field.AbstractField
childDelete, generateCastFromObject, generateCopyLoadObject, generateCopyUpdateObject, generateCreateTableSQL, generateDetach, generateDumpRelationships, generateEquals, generateExpire, generateGet, generateGet, generateInsert, generateInvalidateForeign, generateJavaSelect, generateLoadFromObject, generateMergeFrom, generatePostConstructor, generatePostDelete, generatePostLoadSelect, generatePreDelete, generatePrePersist, generatePrologue, generateSet, generateSet, generateStatementSet, generateSuperGetter, generateSuperGetterMethod, generateSuperSetter, generateSuperSetterMethod, generateUpdate, generateUpdateFromObject, getBeanClass, getCreateLoadMask, getEntitySourceType, getGetterMethod, getGetterName, getIndex, getJavaClass, getJavaType, getJavaTypeName, getLoadGroupIndex, getName, getPersistenceUnit, getSetterMethod, getSetterName, getSourceType, hasLoadGroup, isAbstract, isCascadable, isFieldAccess, isKey, isLazy, isOverride, isUpdateable, link, setIndex, setJavaType, setLazy, setLoadGroupIndex, setName, setOverride, toObject, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyField

public PropertyField(AmberBeanType statefulType,
                     java.lang.String name)
              throws ConfigException
Throws:
ConfigException

PropertyField

public PropertyField(AmberBeanType statefulType)
Method Detail

setType

public void setType(AmberType type)
Sets the result type.


getType

public AmberType getType()
Sets the result type.


getRelatedSourceType

public EntityType getRelatedSourceType()
Returns the source type as entity or mapped-superclass.


getTable

public AmberTable getTable()
Returns the table containing the field's columns.

Specified by:
getTable in interface AmberField
Overrides:
getTable in class AbstractField

setColumn

public void setColumn(AmberColumn column)
Sets the column.

Overrides:
setColumn in class AbstractField

getColumn

public AmberColumn getColumn()
Gets the column.

Specified by:
getColumn in interface AmberField
Overrides:
getColumn in class AbstractField

setInsert

public void setInsert(boolean isInsert)
Set true if the property should be saved on an insert.


isInsert

public boolean isInsert()

setUpdate

public void setUpdate(boolean isUpdate)
Set true if the property should be saved on an update.


isUpdate

public boolean isUpdate()

override

public AmberField override(AmberBeanType type)
Creates a copy of the field for a parent

Specified by:
override in interface AmberField
Overrides:
override in class AbstractField

init

public void init()
          throws ConfigException
Initializes the property.

Specified by:
init in interface AmberField
Overrides:
init in class AbstractField
Throws:
ConfigException

generateGetterMethod

public void generateGetterMethod(JavaWriter out)
                          throws java.io.IOException
Generates the set property.

Specified by:
generateGetterMethod in interface AmberField
Overrides:
generateGetterMethod in class AbstractField
Throws:
java.io.IOException

generateSetterMethod

public void generateSetterMethod(JavaWriter out)
                          throws java.io.IOException
Generates the set property.

Specified by:
generateSetterMethod in interface AmberField
Overrides:
generateSetterMethod in class AbstractField
Throws:
java.io.IOException

generateNull

public java.lang.String generateNull()
Returns the null value.

Overrides:
generateNull in class AbstractField

getFieldName

protected java.lang.String getFieldName()
Returns the field name.

Overrides:
getFieldName in class AbstractField

generateLoadSelect

public java.lang.String generateLoadSelect(AmberTable table,
                                           java.lang.String id)
Generates the select clause.

Specified by:
generateLoadSelect in interface AmberField
Overrides:
generateLoadSelect in class AbstractField

generateSelect

public java.lang.String generateSelect(java.lang.String id)
Generates the select clause.

Specified by:
generateSelect in interface AmberField
Overrides:
generateSelect in class AbstractField

generateWhere

public java.lang.String generateWhere(java.lang.String id)
Generates the where clause.

Specified by:
generateWhere in interface AmberField
Overrides:
generateWhere in class AbstractField

generateInsertColumns

public void generateInsertColumns(java.util.ArrayList<java.lang.String> columns)
Generates the insert.

Specified by:
generateInsertColumns in interface AmberField
Overrides:
generateInsertColumns in class AbstractField

generateUpdate

public void generateUpdate(CharBuffer sql)
Generates the update set clause

Specified by:
generateUpdate in interface AmberField
Overrides:
generateUpdate in class AbstractField

generateInsertSet

public void generateInsertSet(JavaWriter out,
                              java.lang.String pstmt,
                              java.lang.String index,
                              java.lang.String obj)
                       throws java.io.IOException
Generates the set clause for the insert clause.

Specified by:
generateInsertSet in interface AmberField
Overrides:
generateInsertSet in class AbstractField
Throws:
java.io.IOException

generateUpdateSet

public void generateUpdateSet(JavaWriter out,
                              java.lang.String pstmt,
                              java.lang.String index,
                              java.lang.String obj)
                       throws java.io.IOException
Generates the set clause for the insert clause.

Specified by:
generateUpdateSet in interface AmberField
Overrides:
generateUpdateSet in class AbstractField
Throws:
java.io.IOException

generateStatementSet

public void generateStatementSet(JavaWriter out,
                                 java.lang.String pstmt,
                                 java.lang.String index,
                                 java.lang.String obj)
                          throws java.io.IOException
Generates the set clause.

Specified by:
generateStatementSet in interface AmberField
Overrides:
generateStatementSet in class AbstractField
Throws:
java.io.IOException

generateLoad

public int generateLoad(JavaWriter out,
                        java.lang.String rs,
                        java.lang.String indexVar,
                        int index)
                 throws java.io.IOException
Generates loading code

Specified by:
generateLoad in interface AmberField
Overrides:
generateLoad in class AbstractField
Throws:
java.io.IOException

generateLoadNative

public int generateLoadNative(JavaWriter out,
                              int index)
                       throws java.io.IOException
Generates loading code

Specified by:
generateLoadNative in interface AmberField
Overrides:
generateLoadNative in class AbstractField
Throws:
java.io.IOException

generateNativeColumnNames

public void generateNativeColumnNames(java.util.ArrayList<java.lang.String> names)
Generates loading code

Specified by:
generateNativeColumnNames in interface AmberField
Overrides:
generateNativeColumnNames in class AbstractField

createExpr

public AmberExpr createExpr(QueryParser parser,
                            PathExpr parent)
Creates the expression for the field.

Specified by:
createExpr in interface AmberField
Overrides:
createExpr in class AbstractField