Class Patch
java.lang.Object
org.springframework.data.rest.webmvc.json.patch.Patch
- All Implemented Interfaces:
Iterable<PatchOperation>
,Supplier<Stream<PatchOperation>>
,org.springframework.data.util.Streamable<PatchOperation>
public class Patch
extends Object
implements org.springframework.data.util.Streamable<PatchOperation>
Represents a Patch.
This class (and PatchOperation
capture the definition of a patch, but are not coupled to any specific patch
representation.
- Author:
- Craig Walls, Oliver Gierke
-
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.springframework.data.util.Streamable
and, and, and, and, filter, flatMap, get, isEmpty, map, stream, toList, toSet
-
Constructor Details
-
Patch
-
-
Method Details
-
size
public int size()- Returns:
- the number of operations that make up this patch.
-
apply
Applies the Patch to a given Object graph. Makes a copy of the given object so that it will remain unchanged after application of the patch and in case any errors occur while performing the patch.- Type Parameters:
T
- the object type.- Parameters:
in
- The object graph to apply the patch to.type
- The object type.- Returns:
- An object graph modified by the patch.
- Throws:
PatchException
- if there are any errors while applying the patch.
-
apply
Applies the Patch to a given List of objects. Makes a copy of the given list so that it will remain unchanged after application of the patch and in case any errors occur while performing the patch.- Type Parameters:
T
- the list's generic type.- Parameters:
in
- The list to apply the patch to.type
- The list's generic type.- Returns:
- An list modified by the patch.
- Throws:
PatchException
- if there are any errors while applying the patch.
-
iterator
- Specified by:
iterator
in interfaceIterable<PatchOperation>
-