Package net.tangly.core
Record Class DateRange
java.lang.Object
java.lang.Record
net.tangly.core.DateRange
- All Implemented Interfaces:
Serializable
Define an absolute local date range. The range can be open, meaning either the lower or upper date can be null.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordTest if the date is inside the date interval specified in the filter. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.from()Returns the value of thefromrecord component.Create a new data range with the given lower bound.final inthashCode()Returns a hash code value for this object.booleanisActive()Return true if the date now is in the time interval of the instance.booleanReturn true if the date is in the time interval of the instance.booleanReturn true if the date range is fully open.static DateRangeFactory method.to()Returns the value of thetorecord component.Create a new data range with the given upper bound.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
INFINITE
-
-
Constructor Details
-
DateRange
public DateRange()Creates a fully open date range. -
DateRange
-
-
Method Details
-
of
-
from
-
to
-
isActive
Return true if the date is in the time interval of the instance.- Parameters:
date- date against which the inclusion test is evaluated- Returns:
- true if inside the interval otherwise false
-
isActive
public boolean isActive()Return true if the date now is in the time interval of the instance.- Returns:
- true if inside the interval otherwise false
-
isInfinite
public boolean isInfinite()Return true if the date range is fully open.- Returns:
- true if the date range is open in both directions.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
from
Returns the value of thefromrecord component.- Returns:
- the value of the
fromrecord component
-
to
Returns the value of thetorecord component.- Returns:
- the value of the
torecord component
-