Package org.ametys.core.model.type
Class ModelItemTypeHelper
java.lang.Object
org.ametys.core.model.type.ModelItemTypeHelper
Helper model item types
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
areSingleObjectsBothNotNullAndDifferents
(Object object1, Object object2) Checks if the given are both notnull
and if they are differentcompareSingleDates
(LocalDate date1, LocalDate date2, String dataName) compareSingleDates
(ZonedDateTime date1, ZonedDateTime date2, String dataName) compareSingleNumbers
(Number number1, Number number2, String dataName) compareSingleObjects
(Object object1, Object object2, String dataName) compareSingleStrings
(String string1, String string2, String dataName)
-
Method Details
-
compareSingleStrings
public static Optional<Triple<DataChangeType,DataChangeTypeDetail, compareSingleStringsString>> (String string1, String string2, String dataName) Compare the given single strings and retrieves the change as anOptional
ofTriple
. TheTriple
contains:- the general type of the change (added, modified or removed) as a
DataChangeType
, - detail to precise if the changes between the two given strings,
- the data name
- Parameters:
string1
- the 1st single stringstring2
- the 2nd single stringdataName
- the name of the data- Returns:
- the change between the two given single strings
- the general type of the change (added, modified or removed) as a
-
compareSingleObjects
public static Optional<Triple<DataChangeType,DataChangeTypeDetail, compareSingleObjectsString>> (Object object1, Object object2, String dataName) Compare the given single objects and retrieves the change as anOptional
ofTriple
. TheTriple
contains:- the general type of the change (added, modified or removed) as a
DataChangeType
, - detail about this change if possible (after or before for a date, more or less for a number, ...) as a
DataChangeTypeDetail
, - the data name
- Parameters:
object1
- the 1st single objectobject2
- the 2nd single objectdataName
- the name of the data- Returns:
- the change between the two given single objects
- the general type of the change (added, modified or removed) as a
-
compareSingleNumbers
public static Optional<Triple<DataChangeType,DataChangeTypeDetail, compareSingleNumbersString>> (Number number1, Number number2, String dataName) Compare the given single numbers and retrieves the change as anOptional
ofTriple
. TheTriple
contains:- the general type of the change (added, modified or removed) as a
DataChangeType
, - detail to precise if the second number is lower or greater than the first one,
- the data name
- Parameters:
number1
- the 1st single numbernumber2
- the 2nd single numberdataName
- the name of the data- Returns:
- the change between the two given single numbers
- the general type of the change (added, modified or removed) as a
-
compareSingleDates
public static Optional<Triple<DataChangeType,DataChangeTypeDetail, compareSingleDatesString>> (LocalDate date1, LocalDate date2, String dataName) Compare the given singleLocalDate
and retrieves the change as anOptional
ofTriple
. TheTriple
contains:- the general type of the change (added, modified or removed) as a
DataChangeType
, - detail to precise if the second date is before or after the first one,
- the data name
- Parameters:
date1
- the 1st single datedate2
- the 2nd single datedataName
- the name of the data- Returns:
- the change between the two given single dates
- the general type of the change (added, modified or removed) as a
-
compareSingleDates
public static Optional<Triple<DataChangeType,DataChangeTypeDetail, compareSingleDatesString>> (ZonedDateTime date1, ZonedDateTime date2, String dataName) Compare the given singleZonedDateTime
and retrieves the change as anOptional
ofTriple
. TheTriple
contains:- the general type of the change (added, modified or removed) as a
DataChangeType
, - detail to precise if the second date is before or after the first one,
- the data name
- Parameters:
date1
- the 1st single datedate2
- the 2nd single datedataName
- the name of the data- Returns:
- the change between the two given single dates
- the general type of the change (added, modified or removed) as a
-
areSingleObjectsBothNotNullAndDifferents
Checks if the given are both notnull
and if they are different- Parameters:
object1
- the first objectobject2
- the second object- Returns:
true
if both object are notnull
and if they are different,false
otherwise
-