Annotation Interface JsonNaming


@Target(TYPE) @Retention(RUNTIME) @Documented public @interface JsonNaming
JSON Naming - Specifies Property Naming Strategy JSON 命名 - 指定属性命名策略

This annotation specifies the naming strategy for converting Java field names to JSON property names.

此注解指定将 Java 字段名转换为 JSON 属性名的命名策略。

Example | 示例:

@JsonNaming(Strategy.SNAKE_CASE)
public class UserProfile {
    private String userName;      // -> "user_name"
    private String emailAddress;  // -> "email_address"
}

@JsonNaming(Strategy.KEBAB_CASE)
public class Config {
    private String maxRetryCount; // -> "max-retry-count"
}

Features | 主要功能:

  • Multiple naming strategies (snake_case, kebab-case, PascalCase, etc.) - 多种命名策略
  • Class-level naming strategy annotation - 类级命名策略注解

Security | 安全性:

  • Thread-safe: Yes (immutable) - 线程安全: 是(不可变)
  • Null-safe: N/A - 空值安全: 不适用
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
    Class
    Description
    static enum 
    Naming strategy enumeration 命名策略枚举
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The naming strategy to use.
  • Element Details

    • value

      The naming strategy to use. 要使用的命名策略。
      Returns:
      the strategy - 策略
      Default:
      IDENTITY