com.caucho.amber.type
Class ShortType

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

public class ShortType
extends AmberType

Represents a java.util.Short type


Method Summary
static ShortType create()
          Returns the singleton Short type.
 java.lang.String generateCreateColumnSQL(AmberPersistenceUnit manager, int length, int precision, int scale)
          Generates the type for the table.
 java.lang.String generateIncrementVersion(java.lang.String value)
          Generates the increment version.
 int generateLoad(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.
 void generateSetNull(JavaWriter out, java.lang.String pstmt, java.lang.String index)
          Generates a string to set the property.
 void generateSetVersion(JavaWriter out, java.lang.String pstmt, java.lang.String index, java.lang.String value)
          Generates a string to set the property.
 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.
 void setParameter(java.sql.PreparedStatement pstmt, int index, java.lang.Object value)
          Sets the value.
 java.lang.Object toObject(long value)
          Converts to an object.
static java.lang.Short toShort(int value, boolean wasNull)
          Converts a value to a int.
 
Methods inherited from class com.caucho.amber.type.AmberType
findItem, fromObject, generateCastFromObject, generateEquals, generateIsNull, generateLoad, generateLoadForeign, generateNull, getColumnCount, getForeignType, getForeignTypeName, getJavaTypeName, getObject, init, isAssignableTo, isAutoIncrement, isBoolean, toObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static ShortType create()
Returns the singleton Short type.


getName

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

Specified by:
getName in class AmberType

isNumeric

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

Overrides:
isNumeric 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

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

generateSetNull

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

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

generateSetVersion

public void generateSetVersion(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:
generateSetVersion in class AmberType
Throws:
java.io.IOException

generateIncrementVersion

public java.lang.String generateIncrementVersion(java.lang.String value)
                                          throws java.io.IOException
Generates the increment version.

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

toObject

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

Overrides:
toObject in class AmberType

toShort

public static java.lang.Short toShort(int value,
                                      boolean wasNull)
Converts a value to a int.


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

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