com.caucho.amber.field
Class EntityEmbeddedField

java.lang.Object
  extended by com.caucho.amber.field.AbstractField
      extended by com.caucho.amber.field.EntityEmbeddedField
All Implemented Interfaces:
AmberField
Direct Known Subclasses:
EmbeddedIdField

public class EntityEmbeddedField
extends AbstractField

Configuration for a bean's embedded field


Field Summary
protected static java.util.logging.Logger log
           
 
Constructor Summary
EntityEmbeddedField(EntityType ownerType, EmbeddableType embeddableType)
           
EntityEmbeddedField(EntityType ownerType, EmbeddableType embeddableType, java.lang.String name)
           
 
Method Summary
 AmberExpr createExpr(QueryParser parser, PathExpr parent)
          Creates the expression for the field.
protected  EmbeddedSubField createSubField(AmberField field, int index)
           
 void generateCopy(JavaWriter out, java.lang.String dest, java.lang.String source)
          Generates code to copy to an object.
 void generateGetPrimaryKey(CharBuffer cb)
          Generates get property.
 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
 java.lang.String generateLoadSelect(AmberTable table, java.lang.String id)
          Generates the select clause.
 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.
 EmbeddableType getEmbeddableType()
           
 java.util.ArrayList<EmbeddedSubField> getSubFields()
          Returns the subfields.
 AmberType getType()
          Sets the result type.
 void init()
          Initializes the property.
 boolean isEmbeddedId()
          Returns true if the property is an @EmbeddedId.
 void setEmbeddableType(EmbeddableType type)
          Sets the result type.
 void setInsert(boolean isInsert)
          Set true if the property should be saved on an insert.
 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, generateLoadNative, generateMergeFrom, generateNativeColumnNames, generatePostConstructor, generatePostDelete, generatePostLoadSelect, generatePreDelete, generatePrePersist, generatePrologue, generateSet, generateSet, generateStatementSet, generateSuperGetter, generateSuperGetterMethod, generateSuperSetter, generateSuperSetterMethod, generateUpdate, generateUpdateFromObject, getBeanClass, getColumn, getCreateLoadMask, getEntitySourceType, getFieldName, getGetterMethod, getGetterName, getIndex, getJavaClass, getJavaType, getJavaTypeName, getLoadGroupIndex, getName, getPersistenceUnit, getSetterMethod, getSetterName, getSourceType, getTable, hasLoadGroup, isAbstract, isCascadable, isFieldAccess, isKey, isLazy, isOverride, isUpdateable, link, override, setColumn, 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
 

Field Detail

log

protected static final java.util.logging.Logger log
Constructor Detail

EntityEmbeddedField

public EntityEmbeddedField(EntityType ownerType,
                           EmbeddableType embeddableType,
                           java.lang.String name)
                    throws ConfigException
Throws:
ConfigException

EntityEmbeddedField

public EntityEmbeddedField(EntityType ownerType,
                           EmbeddableType embeddableType)
Method Detail

getEmbeddableType

public EmbeddableType getEmbeddableType()

setEmbeddableType

public void setEmbeddableType(EmbeddableType type)
Sets the result type.


createSubField

protected EmbeddedSubField createSubField(AmberField field,
                                          int index)

getType

public AmberType getType()
Sets the result type.


getSubFields

public java.util.ArrayList<EmbeddedSubField> getSubFields()
Returns the subfields.


isEmbeddedId

public boolean isEmbeddedId()
Returns true if the property is an @EmbeddedId.


setInsert

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


setUpdate

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


init

public void init()
          throws ConfigException
Initializes the property.

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

generateNull

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

Overrides:
generateNull in class AbstractField

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

generateCopy

public void generateCopy(JavaWriter out,
                         java.lang.String dest,
                         java.lang.String source)
                  throws java.io.IOException
Generates code to copy to an object.

Throws:
java.io.IOException

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

generateGetPrimaryKey

public void generateGetPrimaryKey(CharBuffer cb)
Generates get property.


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

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