Record Class SerializerInfo
java.lang.Object
java.lang.Record
cloud.opencode.base.serialization.SerializerInfo
- Record Components:
format- the serialization format name (e.g., "json", "xml", "kryo") | 序列化格式名称mimeType- the MIME type (e.g., "application/json") | MIME 类型textBased- whether the serializer produces text output | 是否产生文本输出supportsStreaming- whether the serializer natively supports streaming | 是否原生支持流式处理supportsCompression- whether the serializer supports built-in compression | 是否支持内置压缩description- a human-readable description | 可读描述
public record SerializerInfo(String format, String mimeType, boolean textBased, boolean supportsStreaming, boolean supportsCompression, String description)
extends Record
SerializerInfo - Serializer Capability and Metadata Descriptor
序列化器能力与元数据描述符
An immutable record that describes a serializer's capabilities, including its format, MIME type, whether it is text-based, and optional features like streaming and compression support.
一个不可变记录,描述序列化器的能力,包括格式、MIME 类型、是否基于文本, 以及流式处理和压缩支持等可选功能。
Features | 主要功能:
- Format identification - 格式标识
- MIME type metadata - MIME 类型元数据
- Capability flags (text, streaming, compression) - 能力标志(文本、流式、压缩)
- Human-readable description - 可读描述
Usage Examples | 使用示例:
// Get info from a serializer
SerializerInfo info = serializer.info();
System.out.println(info.format()); // "json"
System.out.println(info.mimeType()); // "application/json"
System.out.println(info.textBased()); // true
// Create directly
SerializerInfo info = new SerializerInfo("json", "application/json", true, true, false, "JSON serializer");
// List all serializer infos
List<SerializerInfo> all = OpenSerializer.listSerializers();
Security | 安全性:
- Thread-safe: Yes (immutable record) - 线程安全: 是(不可变记录)
- Since:
- JDK 25, opencode-base-serialization V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSerializerInfo(String format, String mimeType, boolean textBased, boolean supportsStreaming, boolean supportsCompression, String description) Canonical constructor with validation. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.format()Returns the value of theformatrecord component.final inthashCode()Returns a hash code value for this object.mimeType()Returns the value of themimeTyperecord component.booleanReturns the value of thesupportsCompressionrecord component.booleanReturns the value of thesupportsStreamingrecord component.booleanReturns the value of thetextBasedrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
SerializerInfo
public SerializerInfo(String format, String mimeType, boolean textBased, boolean supportsStreaming, boolean supportsCompression, String description) Canonical constructor with validation. 带验证的规范构造函数。- Parameters:
format- the serialization format name | 序列化格式名称mimeType- the MIME type | MIME 类型textBased- whether text-based | 是否基于文本supportsStreaming- whether streaming is supported | 是否支持流式supportsCompression- whether compression is supported | 是否支持压缩description- the description | 描述
-
-
Method Details
-
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. -
format
-
mimeType
-
textBased
-
supportsStreaming
public boolean supportsStreaming()Returns the value of thesupportsStreamingrecord component.- Returns:
- the value of the
supportsStreamingrecord component
-
supportsCompression
public boolean supportsCompression()Returns the value of thesupportsCompressionrecord component.- Returns:
- the value of the
supportsCompressionrecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-