Class Record

All Implemented Interfaces:
Serializable, Cloneable, Map<String,Object>

public class Record extends HashMap<String,Object>
一个进阶版的Map,一般作为数据库表的一行数据存在。注意他与Map的最大区别是:如果把Bean转换为Record,则默认驼峰命名变为下划线命名方式
Author:
John Li
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      串行版本uid
      See Also:
  • Constructor Details

    • Record

      public Record()
      记录
    • Record

      public Record(Map<String,Object> map)
      记录
      Parameters:
      map - 地图
    • Record

      public Record(int size)
      记录
      Parameters:
      size - 大小
  • Method Details

    • getStr

      public String getStr(String column)
      Get column of mysql type: varchar, char, enum, set, text, tinytext, mediumtext, longtext
      Parameters:
      column - 列
      Returns:
      String
    • getStr

      public String getStr(String column, String defaultStr)
      获得str
      Parameters:
      column - 列
      defaultStr - 默认str
      Returns:
      String
    • getInt

      public Integer getInt(String column)
      Get column of mysql type: int, integer, tinyint(n) n > 1, smallint, mediumint
      Parameters:
      column - 列
      Returns:
      Integer
    • getInt

      public Integer getInt(String column, int def)
      获得int
      Parameters:
      column - 列
      def - def
      Returns:
      Integer
    • getLong

      public Long getLong(String column)
      Get column of mysql type: bigint
      Parameters:
      column - 列
      Returns:
      Long
    • getLong

      public Long getLong(String column, long def)
      获得长
      Parameters:
      column - 列
      def - def
      Returns:
      Long
    • getBigInteger

      public BigInteger getBigInteger(String column)
      Get column of mysql type: unsigned bigint
      Parameters:
      column - 列
      Returns:
      BigInteger
    • getDate

      public Date getDate(String column)
      Get column of mysql type: date, year
      Parameters:
      column - 列
      Returns:
      Date
    • getDouble

      public Double getDouble(String column)
      Get column of mysql type: real, double
      Parameters:
      column - 列
      Returns:
      Double
    • getFloat

      public Float getFloat(String column)
      Get column of mysql type: float
      Parameters:
      column - 列
      Returns:
      Float
    • getBoolean

      public Boolean getBoolean(String column)
      Get column of mysql type: bit, tinyint(1)
      Parameters:
      column - 列
      Returns:
      Boolean
    • getBigDecimal

      public BigDecimal getBigDecimal(String column)
      Get column of mysql type: decimal, numeric
      Parameters:
      column - 列
      Returns:
      BigDecimal
    • getBytes

      public byte[] getBytes(String column)
      Get column of mysql type: binary, varbinary, tinyblob, blob, mediumblob, longblob I have not finished the test.
      Parameters:
      column - 列
      Returns:
      invalid reference
      byte[]
    • getNumber

      public Number getNumber(String column)
      Get column of any type that extends from Number
      Parameters:
      column - 列
      Returns:
      Number
    • getId

      public Long getId()
      get id
      Returns:
      Long
    • getListRecord

      public List<Record> getListRecord(String key)
      get list record
      Parameters:
      key - 键
      Returns:
      Listinvalid input: '<'Record>
    • getList

      private <T> List<T> getList(String key, Function<Object,T> function)
      获得列表
      Parameters:
      key - 键
      function - 函数
      Returns:
      Listinvalid input: '<'Record>
    • getListString

      public List<String> getListString(String key)
      get list
      Parameters:
      key - 键
      Returns:
      Listinvalid input: '<'String>
    • set

      public Record set(String key, Object value)
      设置
      Parameters:
      key - 键
      value - 价值
      Returns:
      Record
    • valueOf

      public static Record valueOf(Object obj)
      Bean对象转换为Record,所有字段名都由驼峰转为下划线格式
      Parameters:
      obj - obj
      Returns:
      Record
    • getRecord

      public Record getRecord(String key)
      获得记录
      Parameters:
      key - 键
      Returns:
      Record
    • convertBeanToMap

      private static Map<String,Object> convertBeanToMap(Object javaBean)
      Bean对象转换为Map,所有字段名都由驼峰转为下划线格式
      Parameters:
      javaBean - java bean
      Returns:
      Mapinvalid input: '<'String, Object>
    • toEntity

      public <T> T toEntity(Class<T> tClass)
      实体
      Type Parameters:
      T - 泛型
      Parameters:
      tClass - t类
      Returns:
      Record
    • valueOfNullable

      public static Record valueOfNullable(Object obj)
      值可以为空
      Parameters:
      obj - obj
      Returns:
      Record