com.caucho.amber.type
Class AmberBeanType

java.lang.Object
  extended by com.caucho.amber.type.AmberType
      extended by com.caucho.amber.type.AbstractEnhancedType
          extended by com.caucho.amber.type.AmberBeanType
Direct Known Subclasses:
ElementType, EmbeddableType, EntityType

public abstract class AmberBeanType
extends AbstractEnhancedType

Represents a stateful type: embeddable, entity or mapped-superclass.


Constructor Summary
AmberBeanType(AmberPersistenceUnit amberPersistenceUnit)
           
 
Method Summary
 void addCompletionField(java.lang.String name)
          Adds a new completion field.
 void addDependency(java.lang.Class cl)
          Adds a dependency.
 void addDependency(PersistentDependency depend)
          Adds a dependency.
 void addField(AmberField field)
          Adds a new field.
 boolean containsCompletionField(java.lang.String completionField)
          Returns true if and only if it has the completion field.
 java.lang.String generateCastFromObject(java.lang.String value)
          Converts the value.
 void generateExpire(JavaWriter out)
          Generates any expiration code.
 void generateInvalidateForeign(JavaWriter out)
          Generates the foreign delete
 int generateLoad(JavaWriter out, java.lang.String rs, java.lang.String indexVar, int index, int loadGroupIndex)
          Generates a string to load the field.
abstract  java.lang.String generateLoadSelect(AmberTable table, java.lang.String id)
          Generates the select clause for a load.
 java.lang.String generateLoadSelect(AmberTable table, java.lang.String id, int loadGroup)
          Generates the select clause for a load.
 void generateLoadSelect(java.lang.StringBuilder sb, AmberTable table, java.lang.String id, int loadGroup)
          Generates the select clause for a load.
 void generatePrePersist(JavaWriter out)
          Returns the load mask generated on create.
 long getCreateLoadMask(int group)
          Returns the load mask generated on create.
 java.util.ArrayList<PersistentDependency> getDependencies()
          Gets the dependency.
 AmberColumn getDiscriminator()
          Returns the discriminator.
static java.lang.reflect.Field getField(java.lang.Class cl, java.lang.String name)
          Gets a matching getter.
 AmberField getField(java.lang.String name)
          Returns the field with a given name.
 java.util.ArrayList<AmberField> getFields()
          Returns the fields.
static java.lang.reflect.Method getGetter(java.lang.Class cl, java.lang.String name)
          Gets a matching getter.
 java.lang.reflect.Method getGetter(java.lang.String name)
          Gets a matching getter.
 java.lang.String getJavaTypeName()
          Returns the java type.
 java.util.ArrayList<AmberField> getSelfFields()
          Returns the fields declared on this instance
static java.lang.reflect.Method getSetter(java.lang.Class cl, java.lang.String name)
          Gets a matching getter.
 void init()
          Initialize the type.
 boolean isEmbeddable()
          Returns true for an embeddable
 boolean isEntity()
           
 boolean isFieldAccess()
          Set true for field-access.
 void removeAllCompletionFields()
          Remove all completion fields.
 void setBeanClass(java.lang.Class beanClass)
          Sets the bean class.
 void setDiscriminator(AmberColumn discriminator)
          Sets the discriminator.
 void setFieldAccess(boolean isFieldAccess)
          Set true for field-access.
 boolean startConfigure()
          Set true if configured.
 
Methods inherited from class com.caucho.amber.type.AbstractEnhancedType
addCallback, addPostLoadCallback, addPostPersistCallback, addPostRemoveCallback, addPostUpdateCallback, addPrePersistCallback, addPreRemoveCallback, addPreUpdateCallback, addStubMethod, getBeanClass, getCallbacks, getClassName, getComponentGenerator, getComponentInterfaceName, getConfigException, getInstance, getInstanceClass, getInstanceClass, getInstanceClassName, getJavaBeanClass, getMethods, getName, getPersistenceUnit, getPostLoadCallbacks, getPostPersistCallbacks, getPostRemoveCallbacks, getPostUpdateCallbacks, getPrePersistCallbacks, getPreRemoveCallbacks, getPreUpdateCallbacks, isEnhanced, isGenerated, isIdClass, isInit, setConfigException, setEnhanced, setGenerated, setIdClass, setInstance, setInstanceClassLoader, setInstanceClassName, setName, toString
 
Methods inherited from class com.caucho.amber.type.AmberType
findItem, fromObject, generateCreateColumnSQL, generateEquals, generateIncrementVersion, generateIsNull, generateLoad, generateLoad, generateLoadForeign, generateLoadNative, generateNull, generateSet, generateSetNull, generateSetVersion, getColumnCount, getForeignType, getForeignTypeName, getObject, getObject, isAssignableTo, isAutoIncrement, isBoolean, isNumeric, setParameter, toObject, toObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AmberBeanType

public AmberBeanType(AmberPersistenceUnit amberPersistenceUnit)
Method Detail

isEntity

public boolean isEntity()

setFieldAccess

public void setFieldAccess(boolean isFieldAccess)
Set true for field-access.


isFieldAccess

public boolean isFieldAccess()
Set true for field-access.


isEmbeddable

public boolean isEmbeddable()
Returns true for an embeddable


getDiscriminator

public AmberColumn getDiscriminator()
Returns the discriminator.


setDiscriminator

public void setDiscriminator(AmberColumn discriminator)
Sets the discriminator.


getJavaTypeName

public java.lang.String getJavaTypeName()
Returns the java type.

Overrides:
getJavaTypeName in class AmberType

addField

public void addField(AmberField field)
Adds a new field.


getSelfFields

public java.util.ArrayList<AmberField> getSelfFields()
Returns the fields declared on this instance


getFields

public java.util.ArrayList<AmberField> getFields()
Returns the fields.


getField

public AmberField getField(java.lang.String name)
Returns the field with a given name.


setBeanClass

public void setBeanClass(java.lang.Class beanClass)
Sets the bean class.

Overrides:
setBeanClass in class AbstractEnhancedType

addDependency

public void addDependency(java.lang.Class cl)
Adds a dependency.


addDependency

public void addDependency(PersistentDependency depend)
Adds a dependency.


getDependencies

public java.util.ArrayList<PersistentDependency> getDependencies()
Gets the dependency.


addCompletionField

public void addCompletionField(java.lang.String name)
Adds a new completion field.


containsCompletionField

public boolean containsCompletionField(java.lang.String completionField)
Returns true if and only if it has the completion field.


removeAllCompletionFields

public void removeAllCompletionFields()
Remove all completion fields.


startConfigure

public boolean startConfigure()
Set true if configured.


init

public void init()
          throws ConfigException
Initialize the type.

Overrides:
init in class AmberType
Throws:
ConfigException

generateCastFromObject

public java.lang.String generateCastFromObject(java.lang.String value)
Converts the value.

Overrides:
generateCastFromObject in class AmberType

generateLoadSelect

public void generateLoadSelect(java.lang.StringBuilder sb,
                               AmberTable table,
                               java.lang.String id,
                               int loadGroup)
Generates the select clause for a load.


generateLoad

public int generateLoad(JavaWriter out,
                        java.lang.String rs,
                        java.lang.String indexVar,
                        int index,
                        int loadGroupIndex)
                 throws java.io.IOException
Generates a string to load the field.

Throws:
java.io.IOException

generateLoadSelect

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


generateLoadSelect

public java.lang.String generateLoadSelect(AmberTable table,
                                           java.lang.String id,
                                           int loadGroup)
Generates the select clause for a load.


generatePrePersist

public void generatePrePersist(JavaWriter out)
                        throws java.io.IOException
Returns the load mask generated on create.

Throws:
java.io.IOException

generateInvalidateForeign

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

Throws:
java.io.IOException

generateExpire

public void generateExpire(JavaWriter out)
                    throws java.io.IOException
Generates any expiration code.

Throws:
java.io.IOException

getGetter

public java.lang.reflect.Method getGetter(java.lang.String name)
Gets a matching getter.


getGetter

public static java.lang.reflect.Method getGetter(java.lang.Class cl,
                                                 java.lang.String name)
Gets a matching getter.


getField

public static java.lang.reflect.Field getField(java.lang.Class cl,
                                               java.lang.String name)
Gets a matching getter.


getSetter

public static java.lang.reflect.Method getSetter(java.lang.Class cl,
                                                 java.lang.String name)
Gets a matching getter.


getCreateLoadMask

public long getCreateLoadMask(int group)
Returns the load mask generated on create.