Interface JsonModule

All Known Implementing Classes:
JsonModule.SimpleModule

public interface JsonModule
JSON Module - Pluggable Module for Extending JSON Processing JSON 模块 - 用于扩展 JSON 处理的可插拔模块

This interface defines a pluggable module that can register custom type adapters, adapter factories, and mixin annotations with the JSON processing framework. Similar to Jackson's Module concept.

此接口定义了一个可插拔模块,可以向 JSON 处理框架注册 自定义类型适配器、适配器工厂和混入注解。类似于 Jackson 的 Module 概念。

Example | 示例:

JsonModule module = new JsonModule.SimpleModule("my-module", "1.0.0")
    .addAdapter(new MoneyAdapter())
    .addMixin(User.class, UserMixin.class);

OpenJson json = OpenJson.withConfig(config)
    .registerModule(module);

Features | 主要功能:

  • Pluggable module system for JSON extensions - 可插拔的 JSON 扩展模块系统
  • Register adapters, factories, and mixins - 注册适配器、工厂和混入
  • SimpleModule for convenient module creation - SimpleModule 用于便捷的模块创建

Security | 安全性:

  • Thread-safe: Implementation-dependent - 线程安全: 取决于实现
  • Null-safe: Partial (validates inputs) - 空值安全: 部分(验证输入)
Since:
JDK 25, opencode-base-json V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Setup Context - Context for Module Configuration 设置上下文 - 模块配置的上下文
    static class 
    Simple Module - Convenient Base Implementation of JsonModule 简单模块 - JsonModule 的便捷基础实现
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the module name.
    Returns the module version.
    void
    Configures the module using the provided setup context.
  • Method Details

    • getName

      String getName()
      Returns the module name. 返回模块名称。
      Returns:
      the module name - 模块名称
    • getVersion

      String getVersion()
      Returns the module version. 返回模块版本。
      Returns:
      the module version - 模块版本
    • setupModule

      void setupModule(JsonModule.SetupContext context)
      Configures the module using the provided setup context. 使用提供的设置上下文配置模块。
      Parameters:
      context - the setup context for registering components - 用于注册组件的设置上下文