Package com.sodius.oslc.server.process
Class ResourceDiff<T extends IExtendedResource>
- java.lang.Object
-
- com.sodius.oslc.server.process.ResourceDiff<T>
-
- Type Parameters:
T
- the type of resources to compare
public class ResourceDiff<T extends IExtendedResource> extends Object
The differences between 2 resources of the same type.- Since:
- 1.14.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ResourceDiff.PropertyValidator
A validator that checks whether a property should be taken into account while computing the diff between 2 resources.static class
ResourceDiff.ResourceDiffBuilder<T extends IExtendedResource>
Builds an instance ofResourceDiff
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getAdditions()
Returns a resource that contains only the properties added to the original resource.T
getRemovals()
Returns a resource that contains only the properties removed from the original resource.T
getResource()
Returns the original resource, updated with all the diff additions and removals.boolean
isModified()
Returnstrue
if this resource diff contains at least 1 addition or 1 removal.static <T extends IExtendedResource>
ResourceDiff.ResourceDiffBuilder<T>of(T original, T updated)
Instantiates a builder to create aResourceDiff
instance between 2 resources.
-
-
-
Method Detail
-
of
public static <T extends IExtendedResource> ResourceDiff.ResourceDiffBuilder<T> of(T original, T updated)
Instantiates a builder to create aResourceDiff
instance between 2 resources.- Type Parameters:
T
- the type of resources to compare- Parameters:
original
- the original resourceupdated
- the updated resource- Returns:
- a builder to create a resource diff
-
getResource
public T getResource()
Returns the original resource, updated with all the diff additions and removals.- Returns:
- the original resource, updated with all the diff additions and removals
-
getAdditions
public T getAdditions()
Returns a resource that contains only the properties added to the original resource.- Returns:
- a resource that contains only the properties added to the original resource
-
getRemovals
public T getRemovals()
Returns a resource that contains only the properties removed from the original resource.- Returns:
- a resource that contains only the properties removed from the original resource
-
isModified
public boolean isModified()
Returnstrue
if this resource diff contains at least 1 addition or 1 removal.- Returns:
- true if this resource diff contains at least 1 addition or 1 removal, false otherwise
-
-