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- 默认枚举读写方式,优先级可参考EnumValnullToEmpty- 是否将数组|集合|Map类型,且为null时转换为空对象,默认trueuseNational- 是否使用unicode字符集, 默认取决于dialect或false, 影响使用ResultSet.getNString(int)还是ResultSet.getString(int)等enableFill- 是否启用填充功能,如果存在generators,则启用batchSize- 批量插入时, 每次最多插入行数,默认500blockUnconditionalDelete- 阻止无条件删除,特殊情况可通过传入Condition.TRUE跳过blockUnconditionalUpdate- 阻止无条件更新,特殊情况可通过传入Condition.TRUE跳过resultInitialCapacity- 集合查询结果(List|Set等)初始容量,建议对齐业务最小每页数量,可避免扩容,默认20resultInitialCapacityMax- 集合查询结果(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
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionConfiguration(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) Creates an instance of aConfigurationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thebatchSizerecord component.booleanReturns the value of theblockUnconditionalDeleterecord component.booleanReturns the value of theblockUnconditionalUpdaterecord component.static ConfigurationBuilderbuilder(ConnectionProvider connectionProvider) 获取BuilderMap<Type, ColumnMapper<?>> Returns the value of thecolumnMappersrecord component.Returns the value of theconnectionProviderrecord component.dialect()Returns the value of thedialectrecord component.booleanReturns the value of theenableFillrecord component.enumBy()Returns the value of theenumByrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thegeneratorsrecord component.final inthashCode()Returns a hash code value for this object.jdbc()Returns the value of thejdbcrecord component.listener()Returns the value of thelistenerrecord component.booleanReturns the value of thenullToEmptyrecord component.intReturns the value of theresultInitialCapacityrecord component.intReturns the value of theresultInitialCapacityMaxrecord component.Returns the value of theserializationMapperrecord component.Returns the value of thesqlExceptionTranslatorrecord component.final StringtoString()Returns a string representation of this record class.booleanReturns the value of theuseNationalrecord component.
-
Constructor Details
-
Configuration
public 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) Creates an instance of aConfigurationrecord class.- Parameters:
connectionProvider- the value for theconnectionProviderrecord componentdialect- the value for thedialectrecord componentjdbc- the value for thejdbcrecord componentsqlExceptionTranslator- the value for thesqlExceptionTranslatorrecord componentlistener- the value for thelistenerrecord componentserializationMapper- the value for theserializationMapperrecord componentcolumnMappers- the value for thecolumnMappersrecord componentgenerators- the value for thegeneratorsrecord componentenumBy- the value for theenumByrecord componentnullToEmpty- the value for thenullToEmptyrecord componentuseNational- the value for theuseNationalrecord componentenableFill- the value for theenableFillrecord componentbatchSize- the value for thebatchSizerecord componentblockUnconditionalDelete- the value for theblockUnconditionalDeleterecord componentblockUnconditionalUpdate- the value for theblockUnconditionalUpdaterecord componentresultInitialCapacity- the value for theresultInitialCapacityrecord componentresultInitialCapacityMax- the value for theresultInitialCapacityMaxrecord component
-
-
Method Details
-
builder
获取Builder- Parameters:
connectionProvider- 连接提供者- Returns:
- 构造器
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
connectionProvider
Returns the value of theconnectionProviderrecord component.- Returns:
- the value of the
connectionProviderrecord component
-
dialect
-
jdbc
-
sqlExceptionTranslator
Returns the value of thesqlExceptionTranslatorrecord component.- Returns:
- the value of the
sqlExceptionTranslatorrecord component
-
listener
-
serializationMapper
Returns the value of theserializationMapperrecord component.- Returns:
- the value of the
serializationMapperrecord component
-
columnMappers
Returns the value of thecolumnMappersrecord component.- Returns:
- the value of the
columnMappersrecord component
-
generators
Returns the value of thegeneratorsrecord component.- Returns:
- the value of the
generatorsrecord component
-
enumBy
-
nullToEmpty
public boolean nullToEmpty()Returns the value of thenullToEmptyrecord component.- Returns:
- the value of the
nullToEmptyrecord component
-
useNational
public boolean useNational()Returns the value of theuseNationalrecord component.- Returns:
- the value of the
useNationalrecord component
-
enableFill
public boolean enableFill()Returns the value of theenableFillrecord component.- Returns:
- the value of the
enableFillrecord component
-
batchSize
-
blockUnconditionalDelete
public boolean blockUnconditionalDelete()Returns the value of theblockUnconditionalDeleterecord component.- Returns:
- the value of the
blockUnconditionalDeleterecord component
-
blockUnconditionalUpdate
public boolean blockUnconditionalUpdate()Returns the value of theblockUnconditionalUpdaterecord component.- Returns:
- the value of the
blockUnconditionalUpdaterecord component
-
resultInitialCapacity
public int resultInitialCapacity()Returns the value of theresultInitialCapacityrecord component.- Returns:
- the value of the
resultInitialCapacityrecord component
-
resultInitialCapacityMax
public int resultInitialCapacityMax()Returns the value of theresultInitialCapacityMaxrecord component.- Returns:
- the value of the
resultInitialCapacityMaxrecord component
-