com.caucho.amber.type
Class EnumType

java.lang.Object
  extended by com.caucho.amber.type.AmberType
      extended by com.caucho.amber.type.EnumType

public class EnumType
extends AmberType

The enum type.


Constructor Summary
EnumType()
           
 
Method Summary
 java.lang.String generateCastFromObject(java.lang.String value)
          Converts the value.
 java.lang.String generateCreateColumnSQL(AmberPersistenceUnit manager, int length, int precision, int scale)
          Generates the type for the table.
 int generateLoad(JavaWriter out, java.lang.String rs, java.lang.String indexVar, int index)
          Generates a string to load the property.
 int generateLoadForeign(JavaWriter out, java.lang.String rs, java.lang.String indexVar, int index)
          Generates a string to load the property.
 int generateLoadNative(JavaWriter out, int index)
          Generates a string to load the property.
 void generateSet(JavaWriter out, java.lang.String pstmt, java.lang.String index, java.lang.String value)
          Generates a string to set the property.
 java.lang.Class getBeanClass()
          Gets the bean class.
 AmberType getForeignType()
          Returns the type as a foreign key.
 java.lang.String getName()
          Returns the type name.
 java.lang.Object getObject(java.sql.ResultSet rs, int index)
          Gets the value.
 boolean isNumeric()
          Returns true for a numeric type.
 boolean isOrdinal()
          Returns true for ordinal
 void setBeanClass(java.lang.Class beanClass)
          Sets the bean class.
 void setName(java.lang.String name)
          Sets the name.
 void setOrdinal(boolean isOrdinal)
          Sets true for ordinal
 void setParameter(java.sql.PreparedStatement pstmt, int index, java.lang.Object value)
          Sets the value.
static java.lang.Object toEnum(int ordinal, boolean wasNull, java.lang.Object[] values)
          Converts a value to a enum.
static java.lang.Object toEnum(java.lang.String name, boolean wasNull, java.lang.Class cl)
          Converts a value to a enum.
 java.lang.Object toObject(long value)
          Converts to an object.
 java.lang.String toObject(java.lang.String value)
          Converts to an object.
 
Methods inherited from class com.caucho.amber.type.AmberType
findItem, fromObject, generateEquals, generateIncrementVersion, generateIsNull, generateLoad, generateNull, generateSetNull, generateSetVersion, getColumnCount, getForeignTypeName, getJavaTypeName, getObject, init, isAssignableTo, isAutoIncrement, isBoolean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumType

public EnumType()
Method Detail

getBeanClass

public java.lang.Class getBeanClass()
Gets the bean class.


setBeanClass

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


getName

public java.lang.String getName()
Returns the type name.

Specified by:
getName in class AmberType

setName

public void setName(java.lang.String name)
Sets the name.


isNumeric

public boolean isNumeric()
Returns true for a numeric type.

Overrides:
isNumeric in class AmberType

isOrdinal

public boolean isOrdinal()
Returns true for ordinal


setOrdinal

public void setOrdinal(boolean isOrdinal)
Sets true for ordinal


getForeignType

public AmberType getForeignType()
Returns the type as a foreign key.

Overrides:
getForeignType in class AmberType

generateCreateColumnSQL

public java.lang.String generateCreateColumnSQL(AmberPersistenceUnit manager,
                                                int length,
                                                int precision,
                                                int scale)
Generates the type for the table.

Overrides:
generateCreateColumnSQL in class AmberType

generateLoad

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

Overrides:
generateLoad in class AmberType
Throws:
java.io.IOException

generateLoadNative

public int generateLoadNative(JavaWriter out,
                              int index)
                       throws java.io.IOException
Generates a string to load the property.

Overrides:
generateLoadNative in class AmberType
Throws:
java.io.IOException

generateLoadForeign

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

Overrides:
generateLoadForeign in class AmberType
Throws:
java.io.IOException

generateSet

public void generateSet(JavaWriter out,
                        java.lang.String pstmt,
                        java.lang.String index,
                        java.lang.String value)
                 throws java.io.IOException
Generates a string to set the property.

Overrides:
generateSet in class AmberType
Throws:
java.io.IOException

setParameter

public void setParameter(java.sql.PreparedStatement pstmt,
                         int index,
                         java.lang.Object value)
                  throws java.sql.SQLException
Sets the value.

Overrides:
setParameter in class AmberType
Throws:
java.sql.SQLException

toObject

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

Overrides:
toObject in class AmberType

generateCastFromObject

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

Overrides:
generateCastFromObject in class AmberType

toEnum

public static java.lang.Object toEnum(int ordinal,
                                      boolean wasNull,
                                      java.lang.Object[] values)
Converts a value to a enum.


toEnum

public static java.lang.Object toEnum(java.lang.String name,
                                      boolean wasNull,
                                      java.lang.Class cl)
Converts a value to a enum.


getObject

public java.lang.Object getObject(java.sql.ResultSet rs,
                                  int index)
                           throws java.sql.SQLException
Gets the value.

Overrides:
getObject in class AmberType
Throws:
java.sql.SQLException

toObject

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

Overrides:
toObject in class AmberType