Class JsonMergePatch.Builder

java.lang.Object
cloud.opencode.base.json.patch.JsonMergePatch.Builder
Enclosing class:
JsonMergePatch

public static final class JsonMergePatch.Builder extends Object
Builder for JsonMergePatch. JsonMergePatch 的构建器。
Since:
JDK 25, opencode-base-json V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • set

      public JsonMergePatch.Builder set(String key, JsonNode value)
      Sets a property value. 设置属性值。
      Parameters:
      key - the property name - 属性名
      value - the value - 值
      Returns:
      this builder - 此构建器
    • set

      public JsonMergePatch.Builder set(String key, String value)
      Sets a string property value. 设置字符串属性值。
      Parameters:
      key - the property name - 属性名
      value - the value - 值
      Returns:
      this builder - 此构建器
    • set

      public JsonMergePatch.Builder set(String key, Number value)
      Sets a number property value. 设置数字属性值。
      Parameters:
      key - the property name - 属性名
      value - the value - 值
      Returns:
      this builder - 此构建器
    • set

      public JsonMergePatch.Builder set(String key, boolean value)
      Sets a boolean property value. 设置布尔属性值。
      Parameters:
      key - the property name - 属性名
      value - the value - 值
      Returns:
      this builder - 此构建器
    • remove

      public JsonMergePatch.Builder remove(String key)
      Removes a property (sets it to null in patch). 移除属性(在补丁中设置为 null)。
      Parameters:
      key - the property name - 属性名
      Returns:
      this builder - 此构建器
    • build

      public JsonMergePatch build()
      Builds the merge patch. 构建合并补丁。
      Returns:
      the merge patch - 合并补丁
    • apply

      public JsonNode apply(JsonNode target)
      Builds and applies the patch to a target. 构建并将补丁应用于目标。
      Parameters:
      target - the target document - 目标文档
      Returns:
      the merged result - 合并结果