Class InDateRangeDual

  • All Implemented Interfaces:
    Predicate<Tuple2<Comparable<Date>,​Comparable<Date>>>

    public class InDateRangeDual
    extends AbstractInTimeRangeDual<Date>

    An InDateRangeDual is a Predicate that tests if there is an overlap between a start Comparable and end Comparable within a provided range [start, end]. The provided start and end dates do not need to be within the range configured, they only need to overlap. To ensure the provided start and/or end are within the configured range the booleans startFullyContained and/or endFullyContained should be set to true (false by default). By default the start and end date comparison is inclusive, you can toggle this using the startInclusive and endInclusive booleans.

    If the start or end are not set then they will be treated as unbounded.

    If the test value is null then the predicate will return false.

    This range predicate takes 2 values to test, if you want to test whether a single value lies within a range then you should use the InDateRange predicate.

    The range can also be configured using time offsets from the current system time or a provided start/end time. You can set the start and end offsets using startOffset and endOffset. By default the offset is measured in Days, this can be changed to DAY, HOUR, MINUTE, SECOND and MILLISECOND using the offsetUnit field.

    When the test is called on the class the current system time is used to calculate the start and end values based on: System.currentTimeMillis() + offset.

    You can configure the start and end time strings using one of the following formats:

    • timestamp in milliseconds
    • yyyy/MM
    • yyyy/MM/dd
    • yyyy/MM/dd HH
    • yyyy/MM/dd HH:mm
    • yyyy/MM/dd HH:mm:ss
    You can use a space, '-', '/', '_', ':', '|', or '.' to separate the parts.
    See Also:
    InDateRangeDual.Builder
    • Constructor Detail

      • InDateRangeDual

        public InDateRangeDual()