com.caucho.amber.field
Class EmbeddedIdField

java.lang.Object
  extended by com.caucho.amber.field.AbstractField
      extended by com.caucho.amber.field.EntityEmbeddedField
          extended by com.caucho.amber.field.EmbeddedIdField
All Implemented Interfaces:
AmberField, IdField

public class EmbeddedIdField
extends EntityEmbeddedField
implements IdField

Configuration for a bean's field


Constructor Summary
EmbeddedIdField(EntityType ownerType, EmbeddableType embeddableType)
           
EmbeddedIdField(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 generateCheckCreateKey(JavaWriter out)
          Generates the set clause.
 java.lang.String generateEquals(java.lang.String left, java.lang.String right)
          Generates code to test the equals.
 java.lang.String generateGetKeyProperty(java.lang.String key)
          Generates the getter for a key property
 java.lang.String generateGetProxyProperty(java.lang.String value)
          Generates the property getter for an EJB proxy
 java.lang.String generateIsNull(java.lang.String value)
          Returns a test for null.
 int generateLoad(JavaWriter out, java.lang.String rs, java.lang.String indexVar, int index)
          Generates loading code
 int generateLoadForeign(JavaWriter out, java.lang.String rs, java.lang.String indexVar, int index)
          Returns the foreign type.
 int generateLoadForeign(JavaWriter out, java.lang.String rs, java.lang.String indexVar, int index, java.lang.String name)
          Returns the foreign type.
 void generateLoadFromObject(JavaWriter out, java.lang.String obj)
          Generates loading cache
 java.lang.String generateLoadSelect(AmberTable table, java.lang.String id)
          Generates the select clause.
 void generateMatch(JavaWriter out, java.lang.String key)
          Generates code for a match.
 java.lang.String generateMatchArgWhere(java.lang.String id)
          Returns the where code
 void generatePrologue(JavaWriter out, java.util.HashSet<java.lang.Object> completedSet)
          Generates any prologue.
 java.lang.String generateRawWhere(java.lang.String id)
          Returns the where code
 void generateSetGeneratedKeys(JavaWriter out, java.lang.String pstmt)
          Generates the set clause.
 void generateSetInsert(JavaWriter out, java.lang.String pstmt, java.lang.String index)
          Generates the set clause.
 java.lang.String generateSetKeyProperty(java.lang.String key, java.lang.String value)
          Generates the setter for a key property
 java.lang.String generateSetNull(java.lang.String obj)
          Generates loading cache
 void generateStatementSet(JavaWriter out, java.lang.String pstmt, java.lang.String index, java.lang.String value)
          Generates the set clause.
 java.util.ArrayList<AmberColumn> getColumns()
          Returns the columns
 int getComponentCount()
          Returns the component count.
 java.lang.String getForeignTypeName()
          Returns the foreign type.
 java.lang.String getGenerator()
          Returns the generator.
 boolean isAutoGenerate()
          Returns true for a generator.
 void setKeyField(boolean isKeyField)
          Set true if key fields are accessed through fields.
 java.lang.String toObject(java.lang.String value)
          Converts to an object.
 java.lang.String toValue(java.lang.String value)
          Converts from an object.
 
Methods inherited from class com.caucho.amber.field.EntityEmbeddedField
generateCopy, generateGetPrimaryKey, generateGetterMethod, generateInsertColumns, generateInsertSet, generateNull, generateSelect, generateSetterMethod, generateUpdate, generateUpdateSet, generateWhere, getEmbeddableType, getSubFields, getType, init, isEmbeddedId, setEmbeddableType, setInsert, setUpdate
 
Methods inherited from class com.caucho.amber.field.AbstractField
childDelete, generateCastFromObject, generateCopyLoadObject, generateCopyUpdateObject, generateCreateTableSQL, generateDetach, generateDumpRelationships, generateExpire, generateGet, generateGet, generateInsert, generateInvalidateForeign, generateJavaSelect, generateLoadNative, generateMergeFrom, generateNativeColumnNames, generatePostConstructor, generatePostDelete, generatePostLoadSelect, generatePreDelete, generatePrePersist, 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, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.caucho.amber.field.IdField
generateCopy, getJavaTypeName, getType
 
Methods inherited from interface com.caucho.amber.field.AmberField
childDelete, generateCastFromObject, generateCopyLoadObject, generateCopyUpdateObject, generateCreateTableSQL, generateDetach, generateDumpRelationships, generateExpire, generateGet, generateGet, generateGetterMethod, generateInsertColumns, generateInsertSet, generateInvalidateForeign, generateJavaSelect, generateLoadNative, generateMergeFrom, generateNativeColumnNames, generatePostConstructor, generatePostDelete, generatePostLoadSelect, generatePreDelete, generatePrePersist, generateSelect, generateSet, generateSet, generateSetterMethod, generateStatementSet, generateSuperGetter, generateSuperGetterMethod, generateSuperSetter, generateSuperSetterMethod, generateUpdate, generateUpdate, generateUpdateFromObject, generateUpdateSet, generateWhere, getColumn, getCreateLoadMask, getGetterMethod, getGetterName, getIndex, getJavaClass, getJavaType, getLoadGroupIndex, getName, getSetterMethod, getSetterName, getSourceType, getTable, hasLoadGroup, init, isAbstract, isCascadable, isLazy, isUpdateable, link, override, setIndex
 

Constructor Detail

EmbeddedIdField

public EmbeddedIdField(EntityType ownerType,
                       EmbeddableType embeddableType)

EmbeddedIdField

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

createSubField

protected EmbeddedSubField createSubField(AmberField field,
                                          int index)
Overrides:
createSubField in class EntityEmbeddedField

getColumns

public java.util.ArrayList<AmberColumn> getColumns()
Returns the columns

Specified by:
getColumns in interface IdField

isAutoGenerate

public boolean isAutoGenerate()
Returns true for a generator.

Specified by:
isAutoGenerate in interface IdField

setKeyField

public void setKeyField(boolean isKeyField)
Set true if key fields are accessed through fields.

Specified by:
setKeyField in interface IdField

getComponentCount

public int getComponentCount()
Returns the component count.

Specified by:
getComponentCount in interface IdField

getForeignTypeName

public java.lang.String getForeignTypeName()
Returns the foreign type.

Specified by:
getForeignTypeName in interface IdField

getGenerator

public java.lang.String getGenerator()
Returns the generator.

Specified by:
getGenerator in interface IdField

generateSetKeyProperty

public java.lang.String generateSetKeyProperty(java.lang.String key,
                                               java.lang.String value)
                                        throws java.io.IOException
Generates the setter for a key property

Specified by:
generateSetKeyProperty in interface IdField
Throws:
java.io.IOException

generateGetKeyProperty

public java.lang.String generateGetKeyProperty(java.lang.String key)
                                        throws java.io.IOException
Generates the getter for a key property

Specified by:
generateGetKeyProperty in interface IdField
Throws:
java.io.IOException

generateGetProxyProperty

public java.lang.String generateGetProxyProperty(java.lang.String value)
Generates the property getter for an EJB proxy

Specified by:
generateGetProxyProperty in interface IdField
Parameters:
value - the non-null value

generatePrologue

public void generatePrologue(JavaWriter out,
                             java.util.HashSet<java.lang.Object> completedSet)
                      throws java.io.IOException
Generates any prologue.

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

generateSetGeneratedKeys

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

Specified by:
generateSetGeneratedKeys in interface IdField
Throws:
java.io.IOException

generateMatchArgWhere

public java.lang.String generateMatchArgWhere(java.lang.String id)
Returns the where code

Specified by:
generateMatchArgWhere in interface IdField

generateRawWhere

public java.lang.String generateRawWhere(java.lang.String id)
Returns the where code

Specified by:
generateRawWhere in interface IdField

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 EntityEmbeddedField
Throws:
java.io.IOException

generateLoadForeign

public int generateLoadForeign(JavaWriter out,
                               java.lang.String rs,
                               java.lang.String indexVar,
                               int index)
                        throws java.io.IOException
Returns the foreign type.

Specified by:
generateLoadForeign in interface IdField
Throws:
java.io.IOException

generateLoadFromObject

public void generateLoadFromObject(JavaWriter out,
                                   java.lang.String obj)
                            throws java.io.IOException
Generates loading cache

Specified by:
generateLoadFromObject in interface AmberField
Overrides:
generateLoadFromObject in class AbstractField
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 EntityEmbeddedField

generateSetNull

public java.lang.String generateSetNull(java.lang.String obj)
                                 throws java.io.IOException
Generates loading cache

Throws:
java.io.IOException

generateIsNull

public java.lang.String generateIsNull(java.lang.String value)
Returns a test for null.

Specified by:
generateIsNull in interface IdField

generateLoadForeign

public int generateLoadForeign(JavaWriter out,
                               java.lang.String rs,
                               java.lang.String indexVar,
                               int index,
                               java.lang.String name)
                        throws java.io.IOException
Returns the foreign type.

Specified by:
generateLoadForeign in interface IdField
Throws:
java.io.IOException

generateStatementSet

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

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

generateMatch

public void generateMatch(JavaWriter out,
                          java.lang.String key)
                   throws java.io.IOException
Generates code for a match.

Throws:
java.io.IOException

generateEquals

public java.lang.String generateEquals(java.lang.String left,
                                       java.lang.String right)
Generates code to test the equals.

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

generateSetInsert

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

Specified by:
generateSetInsert in interface IdField
Throws:
java.io.IOException

generateCheckCreateKey

public void generateCheckCreateKey(JavaWriter out)
                            throws java.io.IOException
Generates the set clause.

Specified by:
generateCheckCreateKey in interface IdField
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 EntityEmbeddedField

toObject

public java.lang.String toObject(java.lang.String value)
Converts to an object.

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

toValue

public java.lang.String toValue(java.lang.String value)
Converts from an object.

Specified by:
toValue in interface IdField