Record Class Configuration

java.lang.Object
java.lang.Record
org.huiche.core.configuration.Configuration
Record Components:
connectionProvider - 连接提供者,必须
dialect - 方言,可选,但一般需要,只要使用方言相关功能即需要, 可以Dialects.of()获取(通过Connection.getMetaData()检测), 使用huiche-spring-boot-starter时默认会检测
jdbc - 原生jdbc配置属性
sqlExceptionTranslator - SQL异常的转换器,可选,接入spring等第三方框架时可能需要
listener - 监听器
serializationMapper - 序列化映射,可选,例如使用json存储复杂数据到数据库(实际使用string存储)
columnMappers - 自定义列类型映射,可选
generators - 自定义列填充器,可选
enumBy - 默认枚举读写方式,优先级可参考EnumVal
nullToEmpty - 是否将数组|集合|Map类型,且为null时转换为空对象,默认true
useNational - 是否使用unicode字符集, 默认取决于dialect或false, 影响使用ResultSet.getNString(int)还是ResultSet.getString(int)
enableFill - 是否启用填充功能,如果存在generators,则启用
batchSize - 批量插入时, 每次最多插入行数,默认500
blockUnconditionalDelete - 阻止无条件删除,特殊情况可通过传入Condition.TRUE跳过
blockUnconditionalUpdate - 阻止无条件更新,特殊情况可通过传入Condition.TRUE跳过
resultInitialCapacity - 集合查询结果(List|Set等)初始容量,建议对齐业务最小每页数量,可避免扩容,默认20
resultInitialCapacityMax - 集合查询结果(List|Set等)初始容量最大值,建议对齐业务最大每页数量,可避免扩容,默认2000

public record Configuration(ConnectionProvider connectionProvider, Dialect dialect, Configuration.Jdbc jdbc, SQLExceptionTranslator sqlExceptionTranslator, Listener listener, SerializationMapper serializationMapper, Map<Type, ColumnMapper<?>> columnMappers, Map<Class<? extends Generator>, Generator> generators, EnumBy enumBy, boolean nullToEmpty, boolean useNational, boolean enableFill, int batchSize, boolean blockUnconditionalDelete, boolean blockUnconditionalUpdate, int resultInitialCapacity, int resultInitialCapacityMax) extends Record
配置
Author:
Maning
  • Constructor Details

  • Method Details

    • builder

      public static ConfigurationBuilder builder(ConnectionProvider connectionProvider)
      获取Builder
      Parameters:
      connectionProvider - 连接提供者
      Returns:
      构造器
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • connectionProvider

      public ConnectionProvider connectionProvider()
      Returns the value of the connectionProvider record component.
      Returns:
      the value of the connectionProvider record component
    • dialect

      public Dialect dialect()
      Returns the value of the dialect record component.
      Returns:
      the value of the dialect record component
    • jdbc

      public Configuration.Jdbc jdbc()
      Returns the value of the jdbc record component.
      Returns:
      the value of the jdbc record component
    • sqlExceptionTranslator

      public SQLExceptionTranslator sqlExceptionTranslator()
      Returns the value of the sqlExceptionTranslator record component.
      Returns:
      the value of the sqlExceptionTranslator record component
    • listener

      public Listener listener()
      Returns the value of the listener record component.
      Returns:
      the value of the listener record component
    • serializationMapper

      public SerializationMapper serializationMapper()
      Returns the value of the serializationMapper record component.
      Returns:
      the value of the serializationMapper record component
    • columnMappers

      public Map<Type, ColumnMapper<?>> columnMappers()
      Returns the value of the columnMappers record component.
      Returns:
      the value of the columnMappers record component
    • generators

      public Map<Class<? extends Generator>, Generator> generators()
      Returns the value of the generators record component.
      Returns:
      the value of the generators record component
    • enumBy

      public EnumBy enumBy()
      Returns the value of the enumBy record component.
      Returns:
      the value of the enumBy record component
    • nullToEmpty

      public boolean nullToEmpty()
      Returns the value of the nullToEmpty record component.
      Returns:
      the value of the nullToEmpty record component
    • useNational

      public boolean useNational()
      Returns the value of the useNational record component.
      Returns:
      the value of the useNational record component
    • enableFill

      public boolean enableFill()
      Returns the value of the enableFill record component.
      Returns:
      the value of the enableFill record component
    • batchSize

      public int batchSize()
      Returns the value of the batchSize record component.
      Returns:
      the value of the batchSize record component
    • blockUnconditionalDelete

      public boolean blockUnconditionalDelete()
      Returns the value of the blockUnconditionalDelete record component.
      Returns:
      the value of the blockUnconditionalDelete record component
    • blockUnconditionalUpdate

      public boolean blockUnconditionalUpdate()
      Returns the value of the blockUnconditionalUpdate record component.
      Returns:
      the value of the blockUnconditionalUpdate record component
    • resultInitialCapacity

      public int resultInitialCapacity()
      Returns the value of the resultInitialCapacity record component.
      Returns:
      the value of the resultInitialCapacity record component
    • resultInitialCapacityMax

      public int resultInitialCapacityMax()
      Returns the value of the resultInitialCapacityMax record component.
      Returns:
      the value of the resultInitialCapacityMax record component