com.caucho.amber.field
Class KeyEmbeddedSubField

java.lang.Object
  extended by com.caucho.amber.field.EmbeddedSubField
      extended by com.caucho.amber.field.KeyEmbeddedSubField
All Implemented Interfaces:
AmberField, IdField

public class KeyEmbeddedSubField
extends EmbeddedSubField
implements IdField

Represents the sub-field of an embedded type.


Field Summary
 
Fields inherited from class com.caucho.amber.field.EmbeddedSubField
log
 
Constructor Summary
KeyEmbeddedSubField(EntityEmbeddedField embeddedField, AmberField embeddableField, int index)
           
 
Method Summary
 void generateCheckCreateKey(JavaWriter out)
          Generates the set for an insert.
 void generateCopy(JavaWriter out, java.lang.String dest, java.lang.String source)
          Generates code to copy to an object.
 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 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.
 java.lang.String generateMatchArgWhere(java.lang.String id)
          Returns the key code
 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 for an insert.
 java.lang.String generateSetKeyProperty(java.lang.String key, java.lang.String value)
          Generates the setter for a key property
 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.
 AmberType getType()
          Returns the column type
 boolean isAutoGenerate()
          Returns true for a generator.
 void setKeyField(boolean isKey)
          Sets true if there are multiple keys.
 java.lang.String toValue(java.lang.String value)
          Converts from an object.
 
Methods inherited from class com.caucho.amber.field.EmbeddedSubField
childDelete, createExpr, generateCastFromObject, generateCopyLoadObject, generateCopyUpdateObject, generateCreateTableSQL, generateDetach, generateDumpRelationships, generateEquals, generateExpire, generateGet, generateGet, generateGetterMethod, generateInsertColumns, generateInsertSet, generateInvalidateForeign, generateJavaSelect, generateLoad, generateLoadFromObject, generateLoadNative, generateLoadSelect, generateMergeFrom, generateNativeColumnNames, generatePostConstructor, generatePostDelete, generatePostLoadSelect, generatePreDelete, generatePrePersist, generatePrologue, generateSelect, generateSet, generateSet, generateSetterMethod, generateStatementSet, generateStatementSet, generateSuperGetter, generateSuperGetterMethod, generateSuperSetter, generateSuperSetterMethod, generateUpdate, generateUpdate, generateUpdateFromObject, generateUpdateSet, generateWhere, getColumn, getCreateLoadMask, getGetterMethod, getGetterName, getIndex, getJavaClass, getJavaType, getJavaTypeName, getLoadGroupIndex, getName, getSetterMethod, getSetterName, getSourceType, getTable, hasLoadGroup, init, isAbstract, isCascadable, isLazy, isUpdateable, link, override, setIndex, toObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.caucho.amber.field.IdField
getJavaTypeName
 
Methods inherited from interface com.caucho.amber.field.AmberField
childDelete, createExpr, generateCastFromObject, generateCopyLoadObject, generateCopyUpdateObject, generateCreateTableSQL, generateDetach, generateDumpRelationships, generateEquals, generateExpire, generateGet, generateGet, generateGetterMethod, generateInsertColumns, generateInsertSet, generateInvalidateForeign, generateJavaSelect, generateLoad, generateLoadFromObject, generateLoadNative, generateLoadSelect, generateMergeFrom, generateNativeColumnNames, generatePostConstructor, generatePostDelete, generatePostLoadSelect, generatePreDelete, generatePrePersist, generatePrologue, generateSelect, generateSet, generateSet, generateSetterMethod, generateStatementSet, 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, toObject
 

Constructor Detail

KeyEmbeddedSubField

public KeyEmbeddedSubField(EntityEmbeddedField embeddedField,
                           AmberField embeddableField,
                           int index)
                    throws ConfigException
Throws:
ConfigException
Method Detail

getColumns

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

Specified by:
getColumns in interface IdField

getType

public AmberType getType()
Returns the column type

Specified by:
getType in interface IdField

isAutoGenerate

public boolean isAutoGenerate()
Returns true for a generator.

Specified by:
isAutoGenerate in interface IdField

setKeyField

public void setKeyField(boolean isKey)
Sets true if there are multiple keys.

Specified by:
setKeyField in interface IdField

getForeignTypeName

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

Specified by:
getForeignTypeName in interface IdField

getComponentCount

public int getComponentCount()
Returns the component count.

Specified by:
getComponentCount in interface IdField

getGenerator

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

Specified by:
getGenerator in interface IdField

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.

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

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

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

generateCheckCreateKey

public void generateCheckCreateKey(JavaWriter out)
                            throws java.io.IOException
Generates the set for an insert.

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

generateSetInsert

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

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

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

generateIsNull

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

Specified by:
generateIsNull in interface IdField

generateRawWhere

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

Specified by:
generateRawWhere in interface IdField

generateMatchArgWhere

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

Specified by:
generateMatchArgWhere in interface IdField

toValue

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

Specified by:
toValue in interface IdField