Interface Range<U>

Type Parameters:
U - The type of the value being restricted

@Incubating public interface Range<U>
Specifies an allowed set or range of values for a value being restricted.

A parameter of a finder method may be declared with type Range<T> where T is the type of the matching field or property of the entity.

Since:
7.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static <U extends Comparable<U>>
    Range<U>
    closed(U lowerBound, U upperBound)
    A closed range containing all values greater than or equal to the given lower bound, and less than or equal to the given upper bound.
    static Range<String>
    containing(String substring)
    A range containing all strings which contain the given substring, with case-sensitivity.
    static Range<String>
    containing(String substring, boolean caseSensitive)
    A range containing all strings which contain the given substring, with case-sensitivity specified explicitly.
    static <U> Range<U>
    empty(Class<U> type)
    An empty range containing no values.
    static <U> Range<U>
    full(Class<U> type)
    A complete range containing all values of the given type.
    Class<? extends U>
    The Java class of the values belonging to this range.
    static <U extends Comparable<U>>
    Range<U>
    greaterThan(U bound)
    A range containing all values strictly greater than the given lower bound.
    static <U extends Comparable<U>>
    Range<U>
    A range containing all values greater than or equal to the given lower bound.
    static <U extends Comparable<U>>
    Range<U>
    lessThan(U bound)
    A range containing all values strictly less than the given upper bound.
    static <U extends Comparable<U>>
    Range<U>
    A range containing all values less than or equal to the given upper bound.
    static <U> Range<U>
    notNull(Class<U> type)
    A range containing all allowed values of the given type except null.
    static <U extends Comparable<U>>
    Range<U>
    open(U lowerBound, U upperBound)
    An open range containing all values strictly greater than the given lower bound, and strictly less than the given upper bound.
    static Range<String>
    pattern(String pattern)
    A range containing all strings which match the given pattern, with case-sensitivity.
    static Range<String>
    pattern(String pattern, boolean caseSensitive)
    A range containing all strings which match the given pattern, with case-sensitivity specified explicitly.
    static Range<String>
    pattern(String pattern, boolean caseSensitive, char charWildcard, char stringWildcard)
    A range containing all strings which match the given pattern, with case-sensitivity specified explicitly.
    static Range<String>
    prefix(String prefix)
    A range containing all strings which begin with the given prefix, with case-sensitivity.
    static Range<String>
    prefix(String prefix, boolean caseSensitive)
    A range containing all strings which begin with the given prefix, with case-sensitivity specified explicitly.
    static Range<String>
    A range containing all strings which are equal to the given string, ignoring case.
    static <U> Range<U>
    singleValue(U value)
    A range containing a single value.
    static Range<String>
    suffix(String suffix)
    A range containing all strings which end with the given suffix, with case-sensitivity.
    static Range<String>
    suffix(String suffix, boolean caseSensitive)
    A range containing all strings which end with the given suffix, with case-sensitivity specified explicitly.
    toPredicate(Path<? extends U> path, CriteriaBuilder builder)
    Return a JPA Criteria Predicate constraining the given attribute of the given root entity to this domain of allowed values.
    static <U> Range<U>
    valueList(List<U> values)
    A range containing all values belonging to the given list.
  • Method Details

    • getType

      Class<? extends U> getType()
      The Java class of the values belonging to this range.
    • toPredicate

      @Internal Predicate toPredicate(Path<? extends U> path, CriteriaBuilder builder)
      Return a JPA Criteria Predicate constraining the given attribute of the given root entity to this domain of allowed values.
    • singleValue

      static <U> Range<U> singleValue(U value)
      A range containing a single value.
    • singleCaseInsensitiveValue

      static Range<String> singleCaseInsensitiveValue(String value)
      A range containing all strings which are equal to the given string, ignoring case.
    • valueList

      static <U> Range<U> valueList(List<U> values)
      A range containing all values belonging to the given list.
    • greaterThan

      static <U extends Comparable<U>> Range<U> greaterThan(U bound)
      A range containing all values strictly greater than the given lower bound.
    • greaterThanOrEqualTo

      static <U extends Comparable<U>> Range<U> greaterThanOrEqualTo(U bound)
      A range containing all values greater than or equal to the given lower bound.
    • lessThan

      static <U extends Comparable<U>> Range<U> lessThan(U bound)
      A range containing all values strictly less than the given upper bound.
    • lessThanOrEqualTo

      static <U extends Comparable<U>> Range<U> lessThanOrEqualTo(U bound)
      A range containing all values less than or equal to the given upper bound.
    • open

      static <U extends Comparable<U>> Range<U> open(U lowerBound, U upperBound)
      An open range containing all values strictly greater than the given lower bound, and strictly less than the given upper bound.
    • closed

      static <U extends Comparable<U>> Range<U> closed(U lowerBound, U upperBound)
      A closed range containing all values greater than or equal to the given lower bound, and less than or equal to the given upper bound.
    • pattern

      static Range<String> pattern(String pattern, boolean caseSensitive)
      A range containing all strings which match the given pattern, with case-sensitivity specified explicitly. The pattern must be expressed in terms of the default wildcard characters _ and %.
      Parameters:
      pattern - A pattern involving the default wildcard characters
      caseSensitive - true if matching is case-sensitive
    • pattern

      static Range<String> pattern(String pattern, boolean caseSensitive, char charWildcard, char stringWildcard)
      A range containing all strings which match the given pattern, with case-sensitivity specified explicitly. The pattern must be expressed in terms of the given single-character and multi-character wildcards.
      Parameters:
      pattern - A pattern involving the given wildcard characters
      caseSensitive - true if matching is case-sensitive
      charWildcard - A wildcard character which matches any single character
      stringWildcard - A wildcard character which matches any string of characters
    • pattern

      static Range<String> pattern(String pattern)
      A range containing all strings which match the given pattern, with case-sensitivity. The pattern must be expressed in terms of the default wildcard characters _ and %.
    • prefix

      static Range<String> prefix(String prefix, boolean caseSensitive)
      A range containing all strings which begin with the given prefix, with case-sensitivity specified explicitly.
    • suffix

      static Range<String> suffix(String suffix, boolean caseSensitive)
      A range containing all strings which end with the given suffix, with case-sensitivity specified explicitly.
    • containing

      static Range<String> containing(String substring, boolean caseSensitive)
      A range containing all strings which contain the given substring, with case-sensitivity specified explicitly.
    • prefix

      static Range<String> prefix(String prefix)
      A range containing all strings which begin with the given prefix, with case-sensitivity.
    • suffix

      static Range<String> suffix(String suffix)
      A range containing all strings which end with the given suffix, with case-sensitivity.
    • containing

      static Range<String> containing(String substring)
      A range containing all strings which contain the given substring, with case-sensitivity.
    • empty

      static <U> Range<U> empty(Class<U> type)
      An empty range containing no values.
    • full

      static <U> Range<U> full(Class<U> type)
      A complete range containing all values of the given type.
    • notNull

      static <U> Range<U> notNull(Class<U> type)
      A range containing all allowed values of the given type except null.