Class Patch
java.lang.Object
org.springframework.data.rest.webmvc.json.patch.Patch
- All Implemented Interfaces:
Iterable<PatchOperation>
,Supplier<Stream<PatchOperation>>
,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 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>
-