com.caucho.amber.field
Interface AmberField

All Known Subinterfaces:
IdField
All Known Implementing Classes:
AbstractField, AssociationField, CascadableField, CollectionElementField, CollectionField, DependentEntityOneToOneField, Discriminator, ElementCollectionField, EmbeddedIdField, EmbeddedSubField, EntityEmbeddedField, EntityMapField, IdentifyingKeyPropertyField, KeyEmbeddedSubField, KeyManyToOneField, KeyPropertyField, ManyToManyField, ManyToOneField, MapElementField, MapManyToManyField, OneToManyField, PropertyField, VersionField

public interface AmberField

Configuration for a bean's property


Method Summary
 void childDelete(AmberConnection aConn, java.io.Serializable primaryKey)
          Deletes the children
 AmberExpr createExpr(QueryParser parser, PathExpr parent)
          Creates the expression for the field.
 java.lang.String generateCastFromObject(java.lang.String value)
          Generates code to convert to the type from the object.
 void generateCopyLoadObject(JavaWriter out, java.lang.String dst, java.lang.String src, int loadIndex)
          Updates the cached copy.
 void generateCopyUpdateObject(JavaWriter out, java.lang.String dst, java.lang.String src, int updateIndex)
          Updates the cached copy.
 java.lang.String generateCreateTableSQL(AmberPersistenceUnit manager)
          Generates the table create.
 void generateDetach(JavaWriter out)
          Generates detachment code
 void generateDumpRelationships(JavaWriter out, int updateIndex)
          Checks entity-relationships from an object.
 java.lang.String generateEquals(java.lang.String leftBase, java.lang.String value)
          Generates code to test the equals.
 void generateExpire(JavaWriter out)
          Generates the expire code.
 void generateGet(JavaWriter out, java.lang.String objThis)
          Generates the field getter.
 java.lang.String generateGet(java.lang.String objThis)
          Generates the field getter.
 void generateGetterMethod(JavaWriter out)
          Generates the get property implementation.
 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.
 void generateInvalidateForeign(JavaWriter out)
          Generates code for foreign entity create/delete
 java.lang.String generateJavaSelect(java.lang.String id)
          Generates the JPA QL select clause.
 int generateLoad(JavaWriter out, java.lang.String rs, java.lang.String indexVar, int loadGroupIndex)
          Generates loading code
 void generateLoadFromObject(JavaWriter out, java.lang.String obj)
          Generates loading cache
 int generateLoadNative(JavaWriter out, int index)
          Generates loading code
 java.lang.String generateLoadSelect(AmberTable table, java.lang.String id)
          Generates the select clause for an entity load.
 void generateMergeFrom(JavaWriter out, java.lang.String dst, java.lang.String src)
          Updates the cached copy.
 void generateNativeColumnNames(java.util.ArrayList<java.lang.String> names)
          Generates loading code
 void generatePostConstructor(JavaWriter out)
          Generates the post constructor fixup
 void generatePostDelete(JavaWriter out)
          Generates the delete foreign
 int generatePostLoadSelect(JavaWriter out, int index)
          Generates loading code after the basic fields.
 void generatePreDelete(JavaWriter out)
          Generates the delete foreign
 void generatePrePersist(JavaWriter out)
          Generates any code needed before a persist occurs
 void generatePrologue(JavaWriter out, java.util.HashSet<java.lang.Object> completedSet)
          Generates any prologue.
 java.lang.String generateSelect(java.lang.String id)
          Generates the select clause.
 void generateSet(JavaWriter out, java.lang.String objThis, java.lang.String value)
          Generates loading cache
 java.lang.String generateSet(java.lang.String objThis, java.lang.String value)
          Generates the field setter.
 void generateSetterMethod(JavaWriter out)
          Generates the set property implementation.
 void generateStatementSet(JavaWriter out, java.lang.String pstmt, java.lang.String index)
          Generates the set clause.
 void generateStatementSet(JavaWriter out, java.lang.String pstmt, java.lang.String index, java.lang.String obj)
          Generates the set clause.
 java.lang.String generateSuperGetter(java.lang.String objThis)
          Returns the actual data.
 void generateSuperGetterMethod(JavaWriter out)
          Generates the get property
 java.lang.String generateSuperSetter(java.lang.String objThis, java.lang.String value)
          Sets the actual data.
 void generateSuperSetterMethod(JavaWriter out)
          Generates the get property
 void generateUpdate(CharBuffer sql)
          Generates the where clause.
 void generateUpdate(JavaWriter out, java.lang.String mask, java.lang.String pstmt, java.lang.String index)
          Generates loading cache
 void generateUpdateFromObject(JavaWriter out, java.lang.String obj)
          Generates loading cache
 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()
          Returns the column for the field.
 long getCreateLoadMask(int group)
          Returns the load group mask.
 java.lang.reflect.Method getGetterMethod()
          Returns the getter method.
 java.lang.String getGetterName()
          Returns the getter name.
 int getIndex()
          Returns the property index.
 java.lang.Class getJavaClass()
          Returns the class of the field
 JType getJavaType()
          Returns the type of the field
 java.lang.String getJavaTypeName()
          Returns the name of the java type.
 int getLoadGroupIndex()
          Returns the property's group index.
 java.lang.String getName()
          Returns the field name.
 java.lang.reflect.Method getSetterMethod()
          Returns the setter method.
 java.lang.String getSetterName()
          Returns the setter name.
 AmberBeanType getSourceType()
          Returns the owning entity class.
 AmberTable getTable()
          Returns the table containing the value (or null)
 boolean hasLoadGroup(int index)
          Generates loading code
 void init()
          Links to the target.
 boolean isAbstract()
          Returns true if the methods are abstract.
 boolean isCascadable()
          Returns true if the field is cascadable.
 boolean isLazy()
          Returns true if and only if this is a LAZY field.
 boolean isUpdateable()
          Returns true for an updateable field.
 void link()
          Links to the target.
 AmberField override(AmberBeanType entityType)
          Override the field
 void setIndex(int index)
          Links to the target.
 java.lang.String toObject(java.lang.String value)
          Converts to an object.
 

Method Detail

getSourceType

AmberBeanType getSourceType()
Returns the owning entity class.


getName

java.lang.String getName()
Returns the field name.


isLazy

boolean isLazy()
Returns true if and only if this is a LAZY field.


getTable

AmberTable getTable()
Returns the table containing the value (or null)


getColumn

AmberColumn getColumn()
Returns the column for the field.


getIndex

int getIndex()
Returns the property index.


getLoadGroupIndex

int getLoadGroupIndex()
Returns the property's group index.


getCreateLoadMask

long getCreateLoadMask(int group)
Returns the load group mask.


getJavaClass

java.lang.Class getJavaClass()
Returns the class of the field


getJavaType

JType getJavaType()
Returns the type of the field


getJavaTypeName

java.lang.String getJavaTypeName()
Returns the name of the java type.


isAbstract

boolean isAbstract()
Returns true if the methods are abstract.


isCascadable

boolean isCascadable()
Returns true if the field is cascadable.


isUpdateable

boolean isUpdateable()
Returns true for an updateable field.


setIndex

void setIndex(int index)
Links to the target.


override

AmberField override(AmberBeanType entityType)
Override the field


init

void init()
          throws ConfigException
Links to the target.

Throws:
ConfigException

generatePrologue

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

Throws:
java.io.IOException

getGetterMethod

java.lang.reflect.Method getGetterMethod()
Returns the getter method.


getSetterMethod

java.lang.reflect.Method getSetterMethod()
Returns the setter method.


getGetterName

java.lang.String getGetterName()
Returns the getter name.


getSetterName

java.lang.String getSetterName()
Returns the setter name.


generateSuperGetter

java.lang.String generateSuperGetter(java.lang.String objThis)
Returns the actual data.


generateSuperSetter

java.lang.String generateSuperSetter(java.lang.String objThis,
                                     java.lang.String value)
Sets the actual data.


generateGet

java.lang.String generateGet(java.lang.String objThis)
Generates the field getter.

Parameters:
value - the non-null value

generateSet

java.lang.String generateSet(java.lang.String objThis,
                             java.lang.String value)
Generates the field setter.

Parameters:
value - the non-null value

generateGet

void generateGet(JavaWriter out,
                 java.lang.String objThis)
                 throws java.io.IOException
Generates the field getter.

Parameters:
value - the non-null value
Throws:
java.io.IOException

generateSet

void generateSet(JavaWriter out,
                 java.lang.String objThis,
                 java.lang.String value)
                 throws java.io.IOException
Generates loading cache

Throws:
java.io.IOException

generateSuperGetterMethod

void generateSuperGetterMethod(JavaWriter out)
                               throws java.io.IOException
Generates the get property

Throws:
java.io.IOException

generateSuperSetterMethod

void generateSuperSetterMethod(JavaWriter out)
                               throws java.io.IOException
Generates the get property

Throws:
java.io.IOException

generateGetterMethod

void generateGetterMethod(JavaWriter out)
                          throws java.io.IOException
Generates the get property implementation.

Throws:
java.io.IOException

generateSetterMethod

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

Throws:
java.io.IOException

generateDetach

void generateDetach(JavaWriter out)
                    throws java.io.IOException
Generates detachment code

Throws:
java.io.IOException

generatePostConstructor

void generatePostConstructor(JavaWriter out)
                             throws java.io.IOException
Generates the post constructor fixup

Throws:
java.io.IOException

generateLoadSelect

java.lang.String generateLoadSelect(AmberTable table,
                                    java.lang.String id)
Generates the select clause for an entity load.


generateSelect

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


generateJavaSelect

java.lang.String generateJavaSelect(java.lang.String id)
Generates the JPA QL select clause.


generateWhere

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


generateUpdate

void generateUpdate(CharBuffer sql)
Generates the where clause.


generateUpdate

void generateUpdate(JavaWriter out,
                    java.lang.String mask,
                    java.lang.String pstmt,
                    java.lang.String index)
                    throws java.io.IOException
Generates loading cache

Throws:
java.io.IOException

hasLoadGroup

boolean hasLoadGroup(int index)
Generates loading code


generateLoad

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

Throws:
java.io.IOException

generatePostLoadSelect

int generatePostLoadSelect(JavaWriter out,
                           int index)
                           throws java.io.IOException
Generates loading code after the basic fields.

Throws:
java.io.IOException

generateLoadFromObject

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

Throws:
java.io.IOException

generateLoadNative

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

Throws:
java.io.IOException

generateNativeColumnNames

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


generateUpdateFromObject

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

Throws:
java.io.IOException

generateInsertColumns

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


generateCreateTableSQL

java.lang.String generateCreateTableSQL(AmberPersistenceUnit manager)
Generates the table create.


generateStatementSet

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

Throws:
java.io.IOException

generateInsertSet

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.

Throws:
java.io.IOException

generateUpdateSet

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.

Throws:
java.io.IOException

generatePrePersist

void generatePrePersist(JavaWriter out)
                        throws java.io.IOException
Generates any code needed before a persist occurs

Throws:
java.io.IOException

generateCopyUpdateObject

void generateCopyUpdateObject(JavaWriter out,
                              java.lang.String dst,
                              java.lang.String src,
                              int updateIndex)
                              throws java.io.IOException
Updates the cached copy.

Throws:
java.io.IOException

generateCopyLoadObject

void generateCopyLoadObject(JavaWriter out,
                            java.lang.String dst,
                            java.lang.String src,
                            int loadIndex)
                            throws java.io.IOException
Updates the cached copy.

Throws:
java.io.IOException

generateMergeFrom

void generateMergeFrom(JavaWriter out,
                       java.lang.String dst,
                       java.lang.String src)
                       throws java.io.IOException
Updates the cached copy.

Throws:
java.io.IOException

generateDumpRelationships

void generateDumpRelationships(JavaWriter out,
                               int updateIndex)
                               throws java.io.IOException
Checks entity-relationships from an object.

Throws:
java.io.IOException

generateStatementSet

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

Throws:
java.io.IOException

toObject

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


link

void link()
Links to the target.


generatePreDelete

void generatePreDelete(JavaWriter out)
                       throws java.io.IOException
Generates the delete foreign

Throws:
java.io.IOException

generatePostDelete

void generatePostDelete(JavaWriter out)
                        throws java.io.IOException
Generates the delete foreign

Throws:
java.io.IOException

generateExpire

void generateExpire(JavaWriter out)
                    throws java.io.IOException
Generates the expire code.

Throws:
java.io.IOException

generateInvalidateForeign

void generateInvalidateForeign(JavaWriter out)
                               throws java.io.IOException
Generates code for foreign entity create/delete

Throws:
java.io.IOException

childDelete

void childDelete(AmberConnection aConn,
                 java.io.Serializable primaryKey)
                 throws java.sql.SQLException
Deletes the children

Throws:
java.sql.SQLException

generateCastFromObject

java.lang.String generateCastFromObject(java.lang.String value)
Generates code to convert to the type from the object.


generateEquals

java.lang.String generateEquals(java.lang.String leftBase,
                                java.lang.String value)
Generates code to test the equals.


createExpr

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