Class DateExpressionVariable
java.lang.Object
com.broadleafcommerce.rulesengine.expression.util.DateExpressionVariable
- All Implemented Interfaces:
ExpressionVariable
Common operations for dates comparison
The methods in this class expect the compared date to be in UTC.
An instance of this class will usually be accessible as a variable within an expression via
#dates.
- Author:
- Dima Myroniuk (dmyroniuk)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()final booleanChecks if the date is after the specified date.final booleanisAfter(LocalDateTime date, String utcDate) Checks if the date is after the specified date.final booleanisAfterOrEqual(Instant date, String utcDate) Checks if the date is after the specified date or is equals to it.final booleanisAfterOrEqual(LocalDateTime date, String utcDate) Checks if the date is after the specified date or is equals to it.final booleanChecks if the date is before the specified date.final booleanisBefore(LocalDateTime date, String utcDate) Checks if the date is before the specified date.final booleanisBeforeOrEqual(Instant date, String utcDate) Checks if the date is before the specified date or is equals to it.final booleanisBeforeOrEqual(LocalDateTime date, String utcDate) Checks if the date is before the specified date or is equals to it.final booleanChecks if dates are equal.final booleanisEqual(LocalDateTime date, String utcDate) Checks if dates are equal.final booleanisNotEqual(Instant date, String utcDate) Checks if dates are not equal.final booleanisNotEqual(LocalDateTime date, String utcDate) Checks if dates are not equal.protected InstantparseUtcDateToInstant(String utcDate) protected LocalDateTimeparseUtcDateToLocalDateTime(String utcDate)
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
DateExpressionVariable
public DateExpressionVariable()
-
-
Method Details
-
getName
- Specified by:
getNamein interfaceExpressionVariable- Returns:
- Name of the variable, must not be null
-
isEqual
Checks if dates are equal.- Parameters:
date- the date to be comparedutcDate- the date in UTC to compare to- Returns:
- true if date is equal to the specified utcDate
-
isEqual
Checks if dates are equal.- Parameters:
date- the date to be comparedutcDate- the date in UTC to compare to- Returns:
- true if date is equal to the specified utcDate
-
isNotEqual
Checks if dates are not equal.- Parameters:
date- the date to be comparedutcDate- the date in UTC to compare to- Returns:
- true if date is not equal to the specified utcDate
-
isNotEqual
Checks if dates are not equal.- Parameters:
date- the date to be comparedutcDate- the date in UTC to compare to- Returns:
- true if date is not equal to the specified utcDate
-
isAfter
Checks if the date is after the specified date.- Parameters:
date- the date to be comparedutcDate- the date in UTC to compare to- Returns:
- true if date is after the specified utcDate
-
isAfter
Checks if the date is after the specified date.- Parameters:
date- the date to be comparedutcDate- the date in UTC to compare to- Returns:
- true if date is after the specified utcDate
-
isAfterOrEqual
Checks if the date is after the specified date or is equals to it.- Parameters:
date- the date to be comparedutcDate- the date in UTC to compare to- Returns:
- true if date is after/equals the specified utcDate
-
isAfterOrEqual
Checks if the date is after the specified date or is equals to it.- Parameters:
date- the date to be comparedutcDate- the date in UTC to compare to- Returns:
- true if date is after/equals the specified utcDate
-
isBefore
Checks if the date is before the specified date.- Parameters:
date- the date to be comparedutcDate- the date in UTC to compare to- Returns:
- true if date is before the specified utcDate
-
isBefore
Checks if the date is before the specified date.- Parameters:
date- the date to be comparedutcDate- the date in UTC to compare to- Returns:
- true if date is before the specified utcDate
-
isBeforeOrEqual
Checks if the date is before the specified date or is equals to it.- Parameters:
date- the date to be comparedutcDate- the date in UTC to compare to- Returns:
- true if date is before/equals the specified utcDate
-
isBeforeOrEqual
Checks if the date is before the specified date or is equals to it.- Parameters:
date- the date to be comparedutcDate- the date in UTC to compare to- Returns:
- true if date is before/equals the specified utcDate
-
parseUtcDateToInstant
-
parseUtcDateToLocalDateTime
-