Interface ColumnMapper<T>

Type Parameters:
T - 列类型
All Known Implementing Classes:
EnumColumnMapper, OptionalColumnMapper, SerializationColumnMapper

public interface ColumnMapper<T>
列转换器
Author:
Maning
  • Method Details

    • canRead

      default boolean canRead(Type type, Configuration configuration)
      是否可读
      Parameters:
      type - 类型
      configuration - 配置
      Returns:
      是否可读
    • read

      T read(ResultSet rs, int columnIndex, Type type, Configuration configuration) throws SQLException
      从ResultSet读取值,请确保安全或已使用canRead(Type, Configuration) 测试
      Parameters:
      rs - 结果集
      columnIndex - rs使用的columnIndex, 从1开始
      type - 类型
      configuration - 配置
      Returns:
      值 允许返回null
      Throws:
      SQLException - 原生SQL异常
    • write

      boolean write(PreparedStatement ps, int parameterIndex, T value, Configuration configuration) throws SQLException
      写入值到PreparedStatement
      Parameters:
      ps - PreparedStatement
      parameterIndex - ps使用的parameterIndex,从1开始
      value - 值,不会为null
      configuration - 配置
      Returns:
      是否已写入
      Throws:
      SQLException - 原生SQL异常