Package jsonvalues

Class Patch.Builder

  • Enclosing class:
    Patch<T extends Json<T>>

    public static final class Patch.Builder
    extends Object
    represents a builder to create json-patch operations according to the RFC 6902 specification.
    • Method Detail

      • add

        public Patch.Builder add​(String path,
                                 JsElem value)
        ADD operation.
        Parameters:
        path - target location of the operation
        value - element to be added
        Returns:
        this builder with an ADD operation appended
      • replace

        public Patch.Builder replace​(String path,
                                     JsElem value)
        REPLACE operation.
        Parameters:
        path - target location of the operation
        value - element to be replaced with
        Returns:
        this builder with a REPLACE operation appended
      • remove

        public Patch.Builder remove​(String path)
        REMOVE operation.
        Parameters:
        path - target location of the operation
        Returns:
        this builder with a REMOVE operation appended
      • test

        public Patch.Builder test​(String path,
                                  JsElem value)
        TEST operation.
        Parameters:
        path - target location of the operation
        value - element to be tested
        Returns:
        this builder with a TEST operation appended
      • move

        public Patch.Builder move​(String from,
                                  String to)
        MOVE operation.
        Parameters:
        from - target location of the operation
        to - source location of the operation
        Returns:
        this builder with a MOVE operation appended
      • copy

        public Patch.Builder copy​(String from,
                                  String to)
        COPY operation.
        Parameters:
        from - target location of the operation
        to - source location of the operation
        Returns:
        this builder with a COPY operation appended
      • toArray

        public JsArray toArray()
        returns the array of operations
        Returns:
        a JsArray
      • toString

        public String toString()
        returns the array of operations as a string
        Overrides:
        toString in class Object
        Returns:
        a String