22
22
* Specialization of {@link QuerySpecification} for programmatic customization of
23
23
* {@linkplain SelectionQuery selection queries} with ordering and restriction criteria.
24
24
* <ul>
25
- * <li>The method {@link #addRestriction (Restriction)} allows application of additional
25
+ * <li>The method {@link #restrict (Restriction)} allows application of additional
26
26
* {@linkplain Restriction filtering} to the query results. The static factory methods
27
27
* of {@link Restriction} are used to express filtering criteria of various kinds.
28
28
* <li>Refinement or replacement of the query sorting criteria is possible via the methods
29
- * {@link #addOrdering (Order)} and {@link #setOrdering (List)}, together with the static
29
+ * {@link #sort (Order)} and {@link #resort (List)}, together with the static
30
30
* factory methods of {@link Order}.
31
31
* </ul>
32
32
* <p>
33
- * Once all {@linkplain #addOrdering sorting} and {@linkplain #addRestriction restrictions}
33
+ * Once all {@linkplain #sort sorting} and {@linkplain #restrict restrictions}
34
34
* are specified, call {@link #createQuery createQuery()} to obtain an
35
35
* {@linkplain SelectionQuery executable selection query object}.
36
36
* <pre>
37
37
* SelectionSpecification.create(Book.class, "from Book where discontinued = false")
38
- * .addRestriction(Restriction.contains(Book_.title, "hibernate", false))
39
- * .setOrdering(Order.desc(Book_.title))
38
+ * .restrict(Restriction.contains(Book_.title, "hibernate", false))
39
+ * .sort(Order.desc(Book_.title))
40
+ * .fetch(Path.from(Book.class).to(Book_publisher))
40
41
* .createQuery(session) // obtain a SelectionQuery
41
42
* .setPage(Page.first(50))
42
43
* .getResultList();
@@ -62,7 +63,7 @@ public interface SelectionSpecification<T> extends QuerySpecification<T> {
62
63
*
63
64
* @return {@code this} for method chaining.
64
65
*/
65
- SelectionSpecification <T > addOrdering (Order <T > order );
66
+ SelectionSpecification <T > sort (Order <T > order );
66
67
67
68
/**
68
69
* Sets the ordering for this selection specification.
@@ -73,7 +74,7 @@ public interface SelectionSpecification<T> extends QuerySpecification<T> {
73
74
*
74
75
* @return {@code this} for method chaining.
75
76
*/
76
- SelectionSpecification <T > setOrdering (Order <T > order );
77
+ SelectionSpecification <T > resort (Order <T > order );
77
78
78
79
/**
79
80
* Sets the sorting for this selection specification.
@@ -84,13 +85,13 @@ public interface SelectionSpecification<T> extends QuerySpecification<T> {
84
85
*
85
86
* @return {@code this} for method chaining.
86
87
*/
87
- SelectionSpecification <T > setOrdering (List <Order <T >> orders );
88
+ SelectionSpecification <T > resort (List <Order <T >> orders );
88
89
89
90
/**
90
91
* Covariant override.
91
92
*/
92
93
@ Override
93
- SelectionSpecification <T > addRestriction (Restriction <T > restriction );
94
+ SelectionSpecification <T > restrict (Restriction <T > restriction );
94
95
95
96
/**
96
97
* Add a fetch {@linkplain Path path} to the specification.
@@ -99,7 +100,7 @@ public interface SelectionSpecification<T> extends QuerySpecification<T> {
99
100
*
100
101
* @return {@code this} for method chaining.
101
102
*/
102
- SelectionSpecification <T > addFetching (Path <T ,?> fetchPath );
103
+ SelectionSpecification <T > fetch (Path <T ,?> fetchPath );
103
104
104
105
/**
105
106
* A function capable of modifying or augmenting a criteria query.
@@ -117,7 +118,7 @@ interface Augmentation<T> {
117
118
* For example:
118
119
* <pre>
119
120
* SelectionSpecification.create(Book.class)
120
- * .addAugmentation ((builder, query, book) ->
121
+ * .augment ((builder, query, book) ->
121
122
* // augment the query via JPA Criteria API
122
123
* query.where(builder.like(book.get(Book_.title), titlePattern)),
123
124
* builder.greaterThan(book.get(Book_.pages), minPages))
@@ -130,7 +131,7 @@ interface Augmentation<T> {
130
131
* the {@link CriteriaBuilder}.
131
132
* <pre>
132
133
* SelectionSpecification.create(Book.class)
133
- * .addAugmentation ((builder, query, book) ->
134
+ * .augment ((builder, query, book) ->
134
135
* // eliminate explicit references to 'builder'
135
136
* new CriteriaDefinition<>(query) {{
136
137
* where(like(entity.get(BasicEntity_.title), titlePattern),
@@ -146,7 +147,7 @@ interface Augmentation<T> {
146
147
*
147
148
* @return {@code this} for method chaining.
148
149
*/
149
- SelectionSpecification <T > addAugmentation (Augmentation <T > augmentation );
150
+ SelectionSpecification <T > augment (Augmentation <T > augmentation );
150
151
151
152
/**
152
153
* Covariant override.
@@ -157,8 +158,8 @@ interface Augmentation<T> {
157
158
/**
158
159
* Returns a specification reference which can be used to programmatically,
159
160
* iteratively build a {@linkplain SelectionQuery} for the given entity type,
160
- * allowing the addition of {@linkplain SelectionSpecification#addOrdering sorting}
161
- * and {@linkplain SelectionSpecification#addRestriction restrictions}.
161
+ * allowing the addition of {@linkplain SelectionSpecification#sort sorting}
162
+ * and {@linkplain SelectionSpecification#restrict restrictions}.
162
163
* This is effectively the same as calling {@linkplain #create(Class, String)}
163
164
* with {@code "from {rootEntityType}"} as the HQL.
164
165
*
@@ -174,8 +175,8 @@ static <T> SelectionSpecification<T> create(Class<T> rootEntityType) {
174
175
/**
175
176
* Returns a specification reference which can be used to programmatically,
176
177
* iteratively build a {@linkplain SelectionQuery} based on a base HQL statement,
177
- * allowing the addition of {@linkplain SelectionSpecification#addOrdering sorting}
178
- * and {@linkplain SelectionSpecification#addRestriction restrictions}.
178
+ * allowing the addition of {@linkplain SelectionSpecification#sort sorting}
179
+ * and {@linkplain SelectionSpecification#restrict restrictions}.
179
180
*
180
181
* @param hql The base HQL query.
181
182
* @param resultType The result type which will ultimately be returned from the {@linkplain SelectionQuery}
@@ -193,8 +194,8 @@ static <T> SelectionSpecification<T> create(Class<T> resultType, String hql) {
193
194
/**
194
195
* Returns a specification reference which can be used to programmatically,
195
196
* iteratively build a {@linkplain SelectionQuery} for the given criteria query,
196
- * allowing the addition of {@linkplain SelectionSpecification#addOrdering sorting}
197
- * and {@linkplain SelectionSpecification#addRestriction restrictions}.
197
+ * allowing the addition of {@linkplain SelectionSpecification#sort sorting}
198
+ * and {@linkplain SelectionSpecification#restrict restrictions}.
198
199
*
199
200
* @param criteria The criteria query
200
201
*
0 commit comments