Class JsonPatchOperation

java.lang.Object
org.apache.juneau.bean.jsonpatch.JsonPatchOperation
Direct Known Subclasses:
AddOp, CopyOp, MoveOp, RemoveOp, ReplaceOp, TestOp

Abstract base for a JSON Patch operation per RFC 6902.

Polymorphic dispatch is wired here via @Marshalled(typePropertyName="op", dictionary={...}): on read, the parser inspects the op member and instantiates the matching concrete subclass; on write, the serializer emits op as the discriminator and the operation's own members alongside.

Not declared sealed - keeping it open lets downstream callers add their own ops if needed (e.g. JSON Patch extensions or vendor-specific test operators) by adding the new subclass to a custom dictionary.

See Also:
  • Constructor Details

    • JsonPatchOperation

      protected JsonPatchOperation()
      Default constructor.
    • JsonPatchOperation

      protected JsonPatchOperation(String path)
      Convenience constructor.
      Parameters:
      path - The JSON Pointer target of the operation. Can be null to leave the property unset.
  • Method Details

    • getPath

      public String getPath()
      Bean property getter: path.

      The target JSON Pointer (RFC 6901) of this operation.

      Returns:
      The value of the path property, or null if it is not set.
    • setPath

      Bean property setter: path.
      Parameters:
      value - The new value for this property. Can be null to unset the property.
      Returns:
      This object.
    • toString

      public String toString()
      Overrides:
      toString in class Object