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 boolean
Checks if the date is after the specified date.final boolean
isAfter
(LocalDateTime date, String utcDate) Checks if the date is after the specified date.final boolean
isAfterOrEqual
(Instant date, String utcDate) Checks if the date is after the specified date or is equals to it.final boolean
isAfterOrEqual
(LocalDateTime date, String utcDate) Checks if the date is after the specified date or is equals to it.final boolean
Checks if the date is before the specified date.final boolean
isBefore
(LocalDateTime date, String utcDate) Checks if the date is before the specified date.final boolean
isBeforeOrEqual
(Instant date, String utcDate) Checks if the date is before the specified date or is equals to it.final boolean
isBeforeOrEqual
(LocalDateTime date, String utcDate) Checks if the date is before the specified date or is equals to it.final boolean
Checks if dates are equal.final boolean
isEqual
(LocalDateTime date, String utcDate) Checks if dates are equal.final boolean
isNotEqual
(Instant date, String utcDate) Checks if dates are not equal.final boolean
isNotEqual
(LocalDateTime date, String utcDate) Checks if dates are not equal.protected Instant
parseUtcDateToInstant
(String utcDate) protected LocalDateTime
parseUtcDateToLocalDateTime
(String utcDate)
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
DateExpressionVariable
public DateExpressionVariable()
-
-
Method Details
-
getName
- Specified by:
getName
in 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
-