@Service public class CompareService extends Object
Constructor and Description |
---|
CompareService(org.javers.core.Javers javers,
VersioningService versioningService) |
Modifier and Type | Method and Description |
---|---|
<T> List<ChangeDTO> |
compare(T obj1,
T obj2)
Compares two objects and returns the changes.
|
List<ChangeDTO> |
compareObjectWithLatestVersion(Object object)
Compares an object with the latest version and returns the changes.
|
List<ChangeDTO> |
compareObjectWithVersion(Object object,
long version)
Compares an object with a specific version and returns the changes.
|
List<ChangeDTO> |
compareVersions(Object object,
long version1,
long version2)
Compares two object versions and returns the changes.
|
protected ChangeDTO |
convertToChangeDTO(org.javers.core.diff.changetype.ValueChange change) |
<T> boolean |
hasChanges(T obj1,
T obj2)
Compares two objects and returns if they have changes or not.
|
@Autowired public CompareService(org.javers.core.Javers javers, VersioningService versioningService)
public <T> boolean hasChanges(@NonNull T obj1, @NonNull T obj2)
T
- the type of the objects to compare, so to ensure that the objects are of the same
classobj1
- the first object to compareobj2
- the second object to comparepublic <T> List<ChangeDTO> compare(@NonNull T obj1, @NonNull T obj2)
T
- the type of the objects to compare, so to ensure that the objects are of the same
classobj1
- the first object to compareobj2
- the second object to comparepublic List<ChangeDTO> compareVersions(Object object, long version1, long version2)
object
- the object to find the requested versions.version1
- number of the first version to compare withversion2
- number of the second version to compare withpublic List<ChangeDTO> compareObjectWithVersion(Object object, long version)
object
- the object to compare with the latest version.version
- number of the version to compare withpublic List<ChangeDTO> compareObjectWithLatestVersion(Object object)
object
- the object to compare with the latest version.protected ChangeDTO convertToChangeDTO(org.javers.core.diff.changetype.ValueChange change)
Copyright © 2019. All rights reserved.