zoukankan      html  css  js  c++  java
  • 枚举类的设计(一)

    public enum JdbcType {
      /*
       * This is added to enable basic support for the
       * ARRAY data type - but a custom type handler is still required
       */
      ARRAY(Types.ARRAY),
      BIT(Types.BIT),
      TINYINT(Types.TINYINT),
      SMALLINT(Types.SMALLINT),
      INTEGER(Types.INTEGER),
      BIGINT(Types.BIGINT),
      FLOAT(Types.FLOAT),
      REAL(Types.REAL),
      DOUBLE(Types.DOUBLE),
      NUMERIC(Types.NUMERIC),
      DECIMAL(Types.DECIMAL),
      CHAR(Types.CHAR),
      VARCHAR(Types.VARCHAR),
      LONGVARCHAR(Types.LONGVARCHAR),
      DATE(Types.DATE),
      TIME(Types.TIME),
      TIMESTAMP(Types.TIMESTAMP),
      BINARY(Types.BINARY),
      VARBINARY(Types.VARBINARY),
      LONGVARBINARY(Types.LONGVARBINARY),
      NULL(Types.NULL),
      OTHER(Types.OTHER),
      BLOB(Types.BLOB),
      CLOB(Types.CLOB),
      BOOLEAN(Types.BOOLEAN),
      CURSOR(-10), // Oracle
      UNDEFINED(Integer.MIN_VALUE + 1000),
      NVARCHAR(Types.NVARCHAR), // JDK6
      NCHAR(Types.NCHAR), // JDK6
      NCLOB(Types.NCLOB), // JDK6
      STRUCT(Types.STRUCT);
    
      public final int TYPE_CODE;
      private static Map<Integer,JdbcType> codeLookup = new HashMap<Integer,JdbcType>();
    
      static {
        for (JdbcType type : JdbcType.values()) {
          codeLookup.put(type.TYPE_CODE, type);
        }
      }
    
      JdbcType(int code) {
        this.TYPE_CODE = code;
      }
    
      public static JdbcType forCode(int code)  {
        return codeLookup.get(code);
      }
    
    }
    

      

  • 相关阅读:
    57. Insert Interval
    287. Find the Duplicate Number
    52. N-Queens II
    51. N-Queens
    151. Reverse Words in a String
    29. Divide Two Integers
    [POJ2104]K-th Number
    [JSOI2008]最大数
    [BZOJ3673&3674]可持久化并查集&加强版
    C++ STL rope介绍----可持久化平衡树
  • 原文地址:https://www.cnblogs.com/X-World/p/6564358.html
Copyright © 2011-2022 走看看