Interface JsonModule.SetupContext
- Enclosing interface:
JsonModule
public static interface JsonModule.SetupContext
Setup Context - Context for Module Configuration
设置上下文 - 模块配置的上下文
Provides methods for modules to register their components (adapters, factories, mixins) with the JSON processing framework.
为模块提供向 JSON 处理框架注册其组件(适配器、工厂、混入)的方法。
- Since:
- JDK 25, opencode-base-json V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddKeyAdapter(Class<?> type, JsonTypeAdapter<?> adapter) Registers a key adapter for map key serialization.voidRegisters a mixin annotation class for a target type.voidaddTypeAdapter(JsonTypeAdapter<?> adapter) Registers a type adapter.voidRegisters a type adapter factory.Returns the current JSON configuration.
-
Method Details
-
addTypeAdapter
Registers a type adapter. 注册类型适配器。- Parameters:
adapter- the type adapter to register - 要注册的类型适配器
-
addTypeAdapterFactory
Registers a type adapter factory. 注册类型适配器工厂。- Parameters:
factory- the factory to register - 要注册的工厂
-
addMixin
-
addKeyAdapter
Registers a key adapter for map key serialization. 注册用于 Map 键序列化的键适配器。- Parameters:
type- the key type - 键类型adapter- the key adapter - 键适配器
-
getConfig
JsonConfig getConfig()Returns the current JSON configuration. 返回当前的 JSON 配置。- Returns:
- the JSON config - JSON 配置
-