java.lang.Object
org.springframework.data.elasticsearch.core.Range<T>

public class Range<T> extends Object
Simple value object to work with ranges and boundaries.
Since:
4.3
Author:
Sascha Woo
  • Method Details

    • closed

      public static <T> Range<T> closed(T from, T to)
      Creates a new Range with inclusive bounds for both values.
      Type Parameters:
      T -
      Parameters:
      from - must not be null.
      to - must not be null.
      Returns:
    • just

      public static <T> Range<T> just(T value)
      Creates a new Range with the given value as sole member.
      Type Parameters:
      T -
      Parameters:
      value - must not be null.
      Returns:
      See Also:
    • leftOpen

      public static <T> Range<T> leftOpen(T from, T to)
      Creates a new left-open Range, i.e. left exclusive, right inclusive.
      Type Parameters:
      T -
      Parameters:
      from - must not be null.
      to - must not be null.
      Returns:
    • leftUnbounded

      public static <T> Range<T> leftUnbounded(Range.Bound<T> to)
      Creates a left-unbounded Range (the left bound set to Range.Bound.unbounded()) with the given right bound.
      Type Parameters:
      T -
      Parameters:
      to - the right Range.Bound, must not be null.
      Returns:
    • of

      public static <T> Range<T> of(Range.Bound<T> lowerBound, Range.Bound<T> upperBound)
      Creates a new Range with the given lower and upper bound.
      Parameters:
      lowerBound - must not be null.
      upperBound - must not be null.
    • open

      public static <T> Range<T> open(T from, T to)
      Creates a new Range with exclusive bounds for both values.
      Type Parameters:
      T -
      Parameters:
      from - must not be null.
      to - must not be null.
      Returns:
    • rightOpen

      public static <T> Range<T> rightOpen(T from, T to)
      Creates a new right-open Range, i.e. left inclusive, right exclusive.
      Type Parameters:
      T -
      Parameters:
      from - must not be null.
      to - must not be null.
      Returns:
    • rightUnbounded

      public static <T> Range<T> rightUnbounded(Range.Bound<T> from)
      Creates a right-unbounded Range (the right bound set to Range.Bound.unbounded()) with the given left bound.
      Type Parameters:
      T -
      Parameters:
      from - the left Range.Bound, must not be null.
      Returns:
    • unbounded

      public static <T> Range<T> unbounded()
      Returns an unbounded Range.
      Returns:
    • contains

      public boolean contains(T value)
      Returns whether the Range contains the given value.
      Parameters:
      value - must not be null.
      Returns:
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getLowerBound

      public Range.Bound<T> getLowerBound()
    • getUpperBound

      public Range.Bound<T> getUpperBound()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object