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 Details

    • addTypeAdapter

      void addTypeAdapter(JsonTypeAdapter<?> adapter)
      Registers a type adapter. 注册类型适配器。
      Parameters:
      adapter - the type adapter to register - 要注册的类型适配器
    • addTypeAdapterFactory

      void addTypeAdapterFactory(JsonTypeAdapterFactory factory)
      Registers a type adapter factory. 注册类型适配器工厂。
      Parameters:
      factory - the factory to register - 要注册的工厂
    • addMixin

      void addMixin(Class<?> target, Class<?> mixin)
      Registers a mixin annotation class for a target type. 为目标类型注册混入注解类。
      Parameters:
      target - the target class to apply mixin to - 要应用混入的目标类
      mixin - the mixin class containing annotations - 包含注解的混入类
    • addKeyAdapter

      void addKeyAdapter(Class<?> type, JsonTypeAdapter<?> adapter)
      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 配置