Skip to content

Commit cdf2c94

Browse files
committed
HHH-18979 rename to ValueList
and fix whitespace
1 parent 6618387 commit cdf2c94

File tree

3 files changed

+43
-39
lines changed

3 files changed

+43
-39
lines changed

hibernate-core/src/main/java/org/hibernate/query/Restriction.java

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
* @author Gavin King
3838
*
3939
* @since 7.0
40-
*
4140
*/
4241
@Incubating
4342
public interface Restriction<X> {
@@ -54,77 +53,77 @@ public interface Restriction<X> {
5453
@Internal
5554
Predicate toPredicate(Root<? extends X> root, CriteriaBuilder builder);
5655

57-
static <T,U> Restriction<T> restrict(SingularAttribute<T,U> attribute, Range<U> range) {
56+
static <T, U> Restriction<T> restrict(SingularAttribute<T, U> attribute, Range<U> range) {
5857
return new AttributeRange<>( attribute, range );
5958
}
6059

61-
static <T,U> Restriction<T> equal(SingularAttribute<T,U> attribute, U value) {
62-
return restrict( attribute, Range.singleValue(value) );
60+
static <T, U> Restriction<T> equal(SingularAttribute<T, U> attribute, U value) {
61+
return restrict( attribute, Range.singleValue( value ) );
6362
}
6463

65-
static <T,U> Restriction<T> unequal(SingularAttribute<T,U> attribute, U value) {
66-
return equal(attribute, value).negated();
64+
static <T, U> Restriction<T> unequal(SingularAttribute<T, U> attribute, U value) {
65+
return equal( attribute, value ).negated();
6766
}
6867

69-
static <T> Restriction<T> equalIgnoringCase(SingularAttribute<T,String> attribute, String value) {
70-
return restrict( attribute, Range.singleCaseInsensitiveValue(value) );
68+
static <T> Restriction<T> equalIgnoringCase(SingularAttribute<T, String> attribute, String value) {
69+
return restrict( attribute, Range.singleCaseInsensitiveValue( value ) );
7170
}
7271

73-
static <T,U> Restriction<T> in(SingularAttribute<T,U> attribute, java.util.List<U> values) {
74-
return restrict( attribute, Range.valueList(values) );
72+
static <T, U> Restriction<T> in(SingularAttribute<T, U> attribute, java.util.List<U> values) {
73+
return restrict( attribute, Range.valueList( values ) );
7574
}
7675

77-
static <T,U> Restriction<T> notIn(SingularAttribute<T,U> attribute, java.util.List<U> values) {
78-
return in(attribute, values).negated();
76+
static <T, U> Restriction<T> notIn(SingularAttribute<T, U> attribute, java.util.List<U> values) {
77+
return in( attribute, values ).negated();
7978
}
8079

81-
static <T,U extends Comparable<U>> Restriction<T> between(SingularAttribute<T,U> attribute, U lowerBound, U upperBound) {
82-
return restrict( attribute, Range.closed(lowerBound, upperBound) );
80+
static <T, U extends Comparable<U>> Restriction<T> between(SingularAttribute<T, U> attribute, U lowerBound, U upperBound) {
81+
return restrict( attribute, Range.closed( lowerBound, upperBound ) );
8382
}
8483

85-
static <T,U extends Comparable<U>> Restriction<T> notBetween(SingularAttribute<T,U> attribute, U lowerBound, U upperBound) {
86-
return between(attribute, lowerBound, upperBound).negated();
84+
static <T, U extends Comparable<U>> Restriction<T> notBetween(SingularAttribute<T, U> attribute, U lowerBound, U upperBound) {
85+
return between( attribute, lowerBound, upperBound ).negated();
8786
}
8887

89-
static <T,U extends Comparable<U>> Restriction<T> greaterThan(SingularAttribute<T,U> attribute, U lowerBound) {
90-
return restrict( attribute, Range.greaterThan(lowerBound) );
88+
static <T, U extends Comparable<U>> Restriction<T> greaterThan(SingularAttribute<T, U> attribute, U lowerBound) {
89+
return restrict( attribute, Range.greaterThan( lowerBound ) );
9190
}
9291

93-
static <T,U extends Comparable<U>> Restriction<T> lessThan(SingularAttribute<T,U> attribute, U upperBound) {
94-
return restrict( attribute, Range.lessThan(upperBound) );
92+
static <T, U extends Comparable<U>> Restriction<T> lessThan(SingularAttribute<T, U> attribute, U upperBound) {
93+
return restrict( attribute, Range.lessThan( upperBound ) );
9594
}
9695

97-
static <T,U extends Comparable<U>> Restriction<T> greaterThanOrEqual(SingularAttribute<T,U> attribute, U lowerBound) {
98-
return restrict( attribute, Range.greaterThanOrEqualTo(lowerBound) );
96+
static <T, U extends Comparable<U>> Restriction<T> greaterThanOrEqual(SingularAttribute<T, U> attribute, U lowerBound) {
97+
return restrict( attribute, Range.greaterThanOrEqualTo( lowerBound ) );
9998
}
10099

101-
static <T,U extends Comparable<U>> Restriction<T> lessThanOrEqual(SingularAttribute<T,U> attribute, U upperBound) {
102-
return restrict( attribute, Range.lessThanOrEqualTo(upperBound) );
100+
static <T, U extends Comparable<U>> Restriction<T> lessThanOrEqual(SingularAttribute<T, U> attribute, U upperBound) {
101+
return restrict( attribute, Range.lessThanOrEqualTo( upperBound ) );
103102
}
104103

105-
static <T> Restriction<T> like(SingularAttribute<T,String> attribute, String pattern, boolean caseSensitive) {
106-
return restrict( attribute, Range.pattern(pattern, caseSensitive) );
104+
static <T> Restriction<T> like(SingularAttribute<T, String> attribute, String pattern, boolean caseSensitive) {
105+
return restrict( attribute, Range.pattern( pattern, caseSensitive ) );
107106
}
108107

109-
static <T> Restriction<T> like(SingularAttribute<T,String> attribute, String pattern) {
110-
return like(attribute, pattern, true);
108+
static <T> Restriction<T> like(SingularAttribute<T, String> attribute, String pattern) {
109+
return like( attribute, pattern, true );
111110
}
112111

113-
static <T> Restriction<T> notLike(SingularAttribute<T,String> attribute, String pattern) {
114-
return like(attribute, pattern, true).negated();
112+
static <T> Restriction<T> notLike(SingularAttribute<T, String> attribute, String pattern) {
113+
return like( attribute, pattern, true ).negated();
115114
}
116115

117-
static <T> Restriction<T> notLike(SingularAttribute<T,String> attribute, String pattern, boolean caseSensitive) {
118-
return like(attribute, pattern, caseSensitive).negated();
116+
static <T> Restriction<T> notLike(SingularAttribute<T, String> attribute, String pattern, boolean caseSensitive) {
117+
return like( attribute, pattern, caseSensitive ).negated();
119118
}
120119

121120
@SafeVarargs
122121
static <T> Restriction<T> and(Restriction<T>... restrictions) {
123-
return new Conjunction<>( java.util.List.of(restrictions) );
122+
return new Conjunction<>( java.util.List.of( restrictions ) );
124123
}
125124

126125
@SafeVarargs
127126
static <T> Restriction<T> or(Restriction<T>... restrictions) {
128-
return new Disjunction<>( java.util.List.of(restrictions) );
127+
return new Disjunction<>( java.util.List.of( restrictions ) );
129128
}
130129
}

hibernate-core/src/main/java/org/hibernate/query/range/Range.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import org.hibernate.Internal;
1313
import org.hibernate.query.Restriction;
1414

15+
import java.util.List;
16+
1517
/**
1618
* Specifies an allowed set of range of values for a value being restricted.
1719
*
@@ -32,7 +34,7 @@ public interface Range<U> {
3234
* values.
3335
*/
3436
@Internal
35-
<X> Predicate toPredicate(Path<? extends X> root, SingularAttribute<X,U> attribute, CriteriaBuilder builder);
37+
<X> Predicate toPredicate(Path<? extends X> root, SingularAttribute<X, U> attribute, CriteriaBuilder builder);
3638

3739
static <U> Range<U> singleValue(U value) {
3840
return new Value<>( value );
@@ -42,8 +44,8 @@ static Range<String> singleCaseInsensitiveValue(String value) {
4244
return new CaseInsensitiveValue( value );
4345
}
4446

45-
static <U> Range<U> valueList(java.util.List<U> values) {
46-
return new List<>( values );
47+
static <U> Range<U> valueList(List<U> values) {
48+
return new ValueList<>( values );
4749
}
4850

4951
static <U extends Comparable<U>> Range<U> greaterThan(U bound) {
@@ -66,12 +68,13 @@ static <U extends Comparable<U>> Range<U> open(U lowerBound, U upperBound) {
6668
return new Interval<>( new LowerBound<>( lowerBound, true ),
6769
new UpperBound<>( upperBound, true ) );
6870
}
71+
6972
static <U extends Comparable<U>> Range<U> closed(U lowerBound, U upperBound) {
7073
return new Interval<>( new LowerBound<>( lowerBound, false ),
7174
new UpperBound<>( upperBound, false ) );
7275
}
7376

7477
static Range<String> pattern(String pattern, boolean caseSensitive) {
75-
return new Pattern(pattern, caseSensitive);
78+
return new Pattern( pattern, caseSensitive );
7679
}
7780
}

hibernate-core/src/main/java/org/hibernate/query/range/List.java renamed to hibernate-core/src/main/java/org/hibernate/query/range/ValueList.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
import jakarta.persistence.criteria.Predicate;
1010
import jakarta.persistence.metamodel.SingularAttribute;
1111

12+
import java.util.List;
13+
1214
/**
1315
* Restricts to a list of literal values.
1416
*/
15-
record List<U>(java.util.List<U> values) implements Range<U> {
17+
record ValueList<U>(List<U> values) implements Range<U> {
1618
@Override
1719
public <X> Predicate toPredicate(Path<? extends X> root, SingularAttribute<X, U> attribute, CriteriaBuilder builder) {
1820
return root.get( attribute ).in( values.stream().map( builder::literal ).toList() );

0 commit comments

Comments
 (0)