Annotation Interface JsonFilter


@Target({TYPE,METHOD,FIELD}) @Retention(RUNTIME) @Documented public @interface JsonFilter
JSON Filter - Specifies a Named Property Filter JSON 过滤器 - 指定命名的属性过滤器

This annotation associates a named filter with a type, method, or field. The filter can then be used to dynamically include or exclude properties during serialization based on runtime logic.

此注解将命名过滤器与类型、方法或字段关联。该过滤器可用于在序列化期间 基于运行时逻辑动态包含或排除属性。

Example | 示例:

@JsonFilter("sensitiveFilter")
public class UserProfile {
    private String name;
    private String email;
    private String ssn;
}
// The "sensitiveFilter" can be configured at runtime to exclude "ssn"

Features | 主要功能:

  • Dynamic property filtering at runtime - 运行时动态属性过滤
  • Named filters for reusability - 命名过滤器以便复用
  • Applicable to types, methods, and fields - 可应用于类型、方法和字段

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:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The filter identifier.
  • Element Details

    • value

      String value
      The filter identifier. 过滤器标识符。
      Returns:
      the filter id - 过滤器 ID