Package org.ametys.core.model.type
Class ModelItemTypeHelper
- java.lang.Object
-
- org.ametys.core.model.type.ModelItemTypeHelper
-
public final class ModelItemTypeHelper extends Object
Helper model item types
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ModelItemTypeHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
areSingleObjectsBothNotNullAndDifferents(Object object1, Object object2)
Checks if the given are both notnull
and if they are differentstatic Optional<Triple<DataChangeType,DataChangeTypeDetail,String>>
compareSingleDates(LocalDate date1, LocalDate date2, String dataName)
static Optional<Triple<DataChangeType,DataChangeTypeDetail,String>>
compareSingleDates(ZonedDateTime date1, ZonedDateTime date2, String dataName)
static Optional<Triple<DataChangeType,DataChangeTypeDetail,String>>
compareSingleNumbers(Number number1, Number number2, String dataName)
static Optional<Triple<DataChangeType,DataChangeTypeDetail,String>>
compareSingleObjects(Object object1, Object object2, String dataName)
static Optional<Triple<DataChangeType,DataChangeTypeDetail,String>>
compareSingleStrings(String string1, String string2, String dataName)
-
-
-
Constructor Detail
-
ModelItemTypeHelper
private ModelItemTypeHelper()
-
-
Method Detail
-
compareSingleStrings
public static Optional<Triple<DataChangeType,DataChangeTypeDetail,String>> compareSingleStrings(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,String>> compareSingleObjects(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,String>> compareSingleNumbers(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,String>> compareSingleDates(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,String>> compareSingleDates(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
public static boolean areSingleObjectsBothNotNullAndDifferents(Object object1, Object object2)
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
-
-