public class DateRange extends Object implements Serializable
org.apache.cassandra.db.marshal.DateRangeType, corresponding to the Apache Solr type DateRangeField.
 A date range can be either single-bounded, in
 which case it represents a unique instant (e.g. "2001-01-01"), or double-bounded, in which case it represents an
 interval of time (e.g. "[2001-01-01 TO 2002]").
 
Date range bounds are always inclusive; they must be either valid
 dates, or the special value UNBOUNDED, represented by a "*", e.g. "[2001 TO *]".
 
Instances can be more easily created with the parse(String) method.
 
This class is immutable and thread-safe.
| Constructor and Description | 
|---|
| DateRange(DateRangeBound singleBound)Creates a "single bounded" instance, i.e., a date range whose upper and lower bounds are
 identical. | 
| DateRange(DateRangeBound lowerBound,
         DateRangeBound upperBound)Creates an instance composed of two distinct bounds. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | equals(Object other) | 
| DateRangeBound | getLowerBound()Returns the lower bound of this range (inclusive). | 
| Optional<DateRangeBound> | getUpperBound()Returns the upper bound of this range (inclusive), or empty if the range is single-bounded. | 
| int | hashCode() | 
| boolean | isSingleBounded()Returns whether this range is single-bounded, i.e. | 
| static DateRange | parse(String source)Parses the given string as a date range. | 
| String | toString()Returns the string representation of this range, in a format compatible with Apache Solr
 DateRageField syntax | 
public DateRange(@NonNull
                 DateRangeBound singleBound)
NullPointerException - if singleBound is null.public DateRange(@NonNull
                 DateRangeBound lowerBound,
                 @NonNull
                 DateRangeBound upperBound)
NullPointerException - if lowerBound or upperBound is null.IllegalArgumentException - if both lowerBound and upperBound are not
     unbounded and lowerBound is greater than upperBound.@NonNull public static DateRange parse(@NonNull String source) throws ParseException
The given input must be compliant with Apache Solr type DateRangeField syntax; it can either be a single-bounded range, or a double-bounded range.
ParseException - if the given string could not be parsed into a valid range.DateRangeBound.parseLowerBound(String), 
DateRangeBound.parseUpperBound(String)@NonNull public DateRangeBound getLowerBound()
@NonNull public Optional<DateRangeBound> getUpperBound()
public boolean isSingleBounded()
@NonNull public String toString()
toString in class ObjectDateRangeBound.toString()Copyright © 2017–2025. All rights reserved.