Class SerializerConfig
java.lang.Object
cloud.opencode.base.serialization.SerializerConfig
SerializerConfig - Serialization Configuration
序列化配置
Configuration options for serialization behavior including compression settings, type information inclusion, and other serialization options.
序列化行为的配置选项,包括压缩设置、类型信息包含和其他序列化选项。
Features | 主要功能:
- Compression control - 压缩控制
- Type information settings - 类型信息设置
- Immutable configuration - 不可变配置
- Builder pattern support - 支持构建器模式
Usage Examples | 使用示例:
// Default configuration
SerializerConfig config = SerializerConfig.defaults();
// Custom configuration
SerializerConfig config = SerializerConfig.builder()
.enableCompression(true)
.compressionAlgorithm(CompressionAlgorithm.GZIP)
.compressionThreshold(1024)
.includeTypeInfo(true)
.build();
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是 (不可变)
Performance | 性能特性:
- Time complexity: O(1) per configuration access - 每次配置访问 O(1)
- Space complexity: O(1) - O(1)
- Since:
- JDK 25, opencode-base-serialization V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for SerializerConfig. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SerializerConfigDefault configuration instance 默认配置实例 -
Method Summary
Modifier and TypeMethodDescriptionstatic SerializerConfig.Builderbuilder()Creates a new builder.static SerializerConfigdefaults()Returns the default configuration.booleanReturns the class filter for deserialization security.Returns the compression algorithm.intReturns the compression threshold in bytes.inthashCode()booleanReturns whether compression is enabled.booleanReturns whether to fail on unknown properties.booleanReturns whether type information should be included.Creates a builder initialized with this configuration.toString()
-
Field Details
-
DEFAULT
Default configuration instance 默认配置实例
-
-
Method Details
-
defaults
Returns the default configuration. 返回默认配置。- Returns:
- the default configuration - 默认配置
-
builder
Creates a new builder. 创建新的构建器。- Returns:
- the builder - 构建器
-
toBuilder
Creates a builder initialized with this configuration. 创建用此配置初始化的构建器。- Returns:
- the builder - 构建器
-
isIncludeTypeInfo
public boolean isIncludeTypeInfo()Returns whether type information should be included. 返回是否应包含类型信息。- Returns:
- true if type info is included - 如果包含类型信息则返回 true
-
isCompressionEnabled
public boolean isCompressionEnabled()Returns whether compression is enabled. 返回是否启用压缩。- Returns:
- true if compression is enabled - 如果启用压缩则返回 true
-
getCompressionAlgorithm
Returns the compression algorithm. 返回压缩算法。- Returns:
- the compression algorithm - 压缩算法
-
getCompressionThreshold
public int getCompressionThreshold()Returns the compression threshold in bytes. 返回压缩阈值(字节)。Data smaller than this threshold will not be compressed.
小于此阈值的数据不会被压缩。
- Returns:
- the compression threshold - 压缩阈值
-
isFailOnUnknownProperties
public boolean isFailOnUnknownProperties()Returns whether to fail on unknown properties. 返回是否对未知属性失败。- Returns:
- true if should fail on unknown properties - 如果应对未知属性失败则返回 true
-
getClassFilter
Returns the class filter for deserialization security. 返回反序列化安全的类过滤器。When non-null, this filter should be consulted before deserializing any class to prevent deserialization of dangerous types.
当非 null 时,应在反序列化任何类之前查询此过滤器, 以防止危险类型的反序列化。
- Returns:
- the class filter, or null if filtering is not enabled | 类过滤器,如果未启用过滤则为 null
- Since:
- JDK 25, opencode-base-serialization V1.0.3
-
equals
-
hashCode
-
toString
-