Klasse TypeMap

java.lang.Object
org.apache.torque.templates.typemapping.TypeMap

public final class TypeMap extends Object
Various mappings for schema types, e.g. to their corresponding Java object types, and Java native types. These are the official SQL type to Java type mappings. These don't quite correspond to the way the peer system works so we'll have to make some adjustments.
 -------------------------------------------------------
 SQL Type      | Java Type            | Peer Type
 -------------------------------------------------------
 CHAR          | String               | String
 VARCHAR       | String               | String
 LONGVARCHAR   | String               | String
 NUMERIC       | java.math.BigDecimal | java.math.BigDecimal
 DECIMAL       | java.math.BigDecimal | java.math.BigDecimal
 BIT           | boolean OR Boolean   | Boolean
 TINYINT       | byte OR Byte         | Byte
 SMALLINT      | short OR Short       | Short
 INTEGER       | int OR Integer       | Integer
 BIGINT        | long OR Long         | Long
 REAL          | float OR Float       | Float
 FLOAT         | double OR Double     | Double
 DOUBLE        | double OR Double     | Double
 BINARY        | byte[]               | ?
 VARBINARY     | byte[]               | ?
 LONGVARBINARY | byte[]               | ?
 DATE          | java.sql.Date        | java.util.Date
 TIME          | java.sql.Time        | java.util.Date
 TIMESTAMP     | java.sql.Timestamp   | java.util.Date

 -------------------------------------------------------
 A couple variations have been introduced to cover cases
 that may arise, but are not covered above
 BOOLEANCHAR   | boolean OR Boolean   | String
 BOOLEANINT    | boolean OR Boolean   | Integer
 
Version:
$Id: TypeMap.java 1917023 2024-04-16 10:12:17Z gk $
Autor:
Jason van Zyl, Martin Poeschl
  • Felddetails

    • CHAR_OBJECT_TYPE

      public static final String CHAR_OBJECT_TYPE
      A sample java object for CHAR columns.
      Siehe auch:
    • VARCHAR_OBJECT_TYPE

      public static final String VARCHAR_OBJECT_TYPE
      A sample java object for VARCHAR columns.
      Siehe auch:
    • LONGVARCHAR_OBJECT_TYPE

      public static final String LONGVARCHAR_OBJECT_TYPE
      A sample java object for LONGVARCHAR columns.
      Siehe auch:
    • CLOB_OBJECT_TYPE

      public static final String CLOB_OBJECT_TYPE
      A sample java object for CLOB columns.
      Siehe auch:
    • NUMERIC_OBJECT_TYPE

      public static final String NUMERIC_OBJECT_TYPE
      A sample java object for NUMERIC columns.
      Siehe auch:
    • DECIMAL_OBJECT_TYPE

      public static final String DECIMAL_OBJECT_TYPE
      A sample java object for DECIMAL columns.
      Siehe auch:
    • BIT_OBJECT_TYPE

      public static final String BIT_OBJECT_TYPE
      A sample java object for BIT columns.
      Siehe auch:
    • TINYINT_OBJECT_TYPE

      public static final String TINYINT_OBJECT_TYPE
      A sample java object for TINYINT columns.
      Siehe auch:
    • SMALLINT_OBJECT_TYPE

      public static final String SMALLINT_OBJECT_TYPE
      A sample java object for SMALLINT columns.
      Siehe auch:
    • INTEGER_OBJECT_TYPE

      public static final String INTEGER_OBJECT_TYPE
      A sample java object for INTEGER columns.
      Siehe auch:
    • BIGINT_OBJECT_TYPE

      public static final String BIGINT_OBJECT_TYPE
      A sample java object for BIGINT columns.
      Siehe auch:
    • REAL_OBJECT_TYPE

      public static final String REAL_OBJECT_TYPE
      A sample java object for REAL columns.
      Siehe auch:
    • FLOAT_OBJECT_TYPE

      public static final String FLOAT_OBJECT_TYPE
      A sample java object for FLOAT columns.
      Siehe auch:
    • DOUBLE_OBJECT_TYPE

      public static final String DOUBLE_OBJECT_TYPE
      A sample java object for DOUBLE columns.
      Siehe auch:
    • BINARY_OBJECT_TYPE

      public static final String BINARY_OBJECT_TYPE
      A sample java object for BINARY columns.
      Siehe auch:
    • VARBINARY_OBJECT_TYPE

      public static final String VARBINARY_OBJECT_TYPE
      A sample java object for VARBINARY columns.
      Siehe auch:
    • LONGVARBINARY_OBJECT_TYPE

      public static final String LONGVARBINARY_OBJECT_TYPE
      A sample java object for LONGVARBINARY columns.
      Siehe auch:
    • BLOB_OBJECT_TYPE

      public static final String BLOB_OBJECT_TYPE
      A sample java object for BLOB columns.
      Siehe auch:
    • DATE_OBJECT_TYPE

      public static final String DATE_OBJECT_TYPE
      A sample java object for DATE columns.
      Siehe auch:
    • TIME_OBJECT_TYPE

      public static final String TIME_OBJECT_TYPE
      A sample java object for TIME columns.
      Siehe auch:
    • TIMESTAMP_OBJECT_TYPE

      public static final String TIMESTAMP_OBJECT_TYPE
      A sample java object for TIMESTAMP columns.
      Siehe auch:
    • BOOLEANCHAR_OBJECT_TYPE

      public static final String BOOLEANCHAR_OBJECT_TYPE
      A sample java object for BOOLEANCHAR columns.
      Siehe auch:
    • BOOLEANINT_OBJECT_TYPE

      public static final String BOOLEANINT_OBJECT_TYPE
      A sample java object for BOOLEANINT columns.
      Siehe auch:
  • Methodendetails

    • getJavaObject

      public static String getJavaObject(SchemaType jdbcType)
      Return a Java object which corresponds to the JDBC type provided. Use in MapBuilder generation.
      Parameter:
      jdbcType - the JDBC type
      Gibt zurück:
      name of the Object
    • getJavaPrimitiveType

      public static JavaType getJavaPrimitiveType(SchemaType schemaType)
      Returns the java type which corresponds to the schema type provided. Where possible, primitive types are used.
      Parameter:
      schemaType - the schema type.
      Gibt zurück:
      name of the native java type
    • getJavaObjectType

      public static JavaType getJavaObjectType(SchemaType schemaType)
      Returns the java type which corresponds to the schema type provided. Only Object types are used.
      Parameter:
      schemaType - the schema type.
      Gibt zurück:
      the corresponding java Type.
    • getResultSetGetter

      public static ResultSetGetter getResultSetGetter(SchemaType schemaType)
      Returns the result set getter method which corresponds to the Schema type provided.
      Parameter:
      schemaType - the schema type
      Gibt zurück:
      the result set getter method.
    • isBooleanInt

      public static boolean isBooleanInt(SchemaType type)
      Returns true if the type is boolean in the java object and a numeric (1 or 0) in the db.
      Parameter:
      type - The type to check.
      Gibt zurück:
      true if the type is BOOLEANINT
    • isBooleanChar

      public static boolean isBooleanChar(SchemaType type)
      Returns true if the type is boolean in the java object and a String "Y" or "N" in the db.
      Parameter:
      type - The type to check.
      Gibt zurück:
      true if the type is BOOLEANCHAR
    • isBit

      public static boolean isBit(SchemaType type)
      Returns true if the type is boolean in the java object and a Bit "1" or "0" in the db.
      Parameter:
      type - The type to check.
      Gibt zurück:
      true if the type is BIT
    • isTextType

      public static boolean isTextType(SchemaType type)
      Returns true if values for the type need to be quoted.
      Parameter:
      type - The type to check.
      Gibt zurück:
      true if values for the type need to be quoted.