BrightSide Workbench Full Report + Source Code
JpaRoot.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2020 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.jpa.query;
20 
21 import java.util.Collection;
22 import java.util.List;
23 import java.util.Map;
24 import java.util.Set;
25 import javax.persistence.criteria.CollectionJoin;
26 import javax.persistence.criteria.Expression;
27 import javax.persistence.criteria.Fetch;
28 import javax.persistence.criteria.From;
29 import javax.persistence.criteria.Join;
30 import javax.persistence.criteria.JoinType;
31 import javax.persistence.criteria.ListJoin;
32 import javax.persistence.criteria.MapJoin;
33 import javax.persistence.criteria.Path;
34 import javax.persistence.criteria.Predicate;
35 import javax.persistence.criteria.Root;
36 import javax.persistence.criteria.Selection;
37 import javax.persistence.criteria.SetJoin;
38 import javax.persistence.metamodel.CollectionAttribute;
39 import javax.persistence.metamodel.EntityType;
40 import javax.persistence.metamodel.ListAttribute;
41 import javax.persistence.metamodel.MapAttribute;
42 import javax.persistence.metamodel.PluralAttribute;
43 import javax.persistence.metamodel.SetAttribute;
44 import javax.persistence.metamodel.SingularAttribute;
45 
50 public class JpaRoot<T> implements Root<T> {
51 
52  protected Root<T> root;
53 
54  public JpaRoot(Root<T> root) {
55  this.root = root;
56  }
57 
58  public Root<T> root() {
59  return root;
60  }
61 
62  @Override
63  public EntityType<T> getModel() {
64  return root.getModel();
65  }
66 
67  @Override
68  public Set<Join<T, ?>> getJoins() {
69  return root.getJoins();
70  }
71 
72  @Override
73  public boolean isCorrelated() {
74  return root.isCorrelated();
75  }
76 
77  @Override
78  public From<T, T> getCorrelationParent() {
79  return root.getCorrelationParent();
80  }
81 
82  @Override
83  public <Y> Join<T, Y> join(SingularAttribute<? super T, Y> attribute) {
84  return root.join(attribute);
85  }
86 
87  @Override
88  public <Y> Join<T, Y> join(SingularAttribute<? super T, Y> attribute, JoinType jt) {
89  return root.join(attribute, jt);
90  }
91 
92  @Override
93  public <Y> CollectionJoin<T, Y> join(CollectionAttribute<? super T, Y> collection) {
94  return root.join(collection);
95  }
96 
97  @Override
98  public <Y> SetJoin<T, Y> join(SetAttribute<? super T, Y> set) {
99  return root.join(set);
100  }
101 
102  @Override
103  public <Y> ListJoin<T, Y> join(ListAttribute<? super T, Y> list) {
104  return root.join(list);
105  }
106 
107  @Override
108  public <K, V> MapJoin<T, K, V> join(MapAttribute<? super T, K, V> map) {
109  return root.join(map);
110  }
111 
112  @Override
113  public <Y> CollectionJoin<T, Y> join(CollectionAttribute<? super T, Y> collection, JoinType jt) {
114  return root.join(collection, jt);
115  }
116 
117  @Override
118  public <Y> SetJoin<T, Y> join(SetAttribute<? super T, Y> set, JoinType jt) {
119  return root.join(set, jt);
120  }
121 
122  @Override
123  public <Y> ListJoin<T, Y> join(ListAttribute<? super T, Y> list, JoinType jt) {
124  return root.join(list, jt);
125  }
126 
127  @Override
128  public <K, V> MapJoin<T, K, V> join(MapAttribute<? super T, K, V> map, JoinType jt) {
129  return root.join(map, jt);
130  }
131 
132  @Override
133  public <X, Y> Join<X, Y> join(String attributeName) {
134  return root.join(attributeName);
135  }
136 
137  @Override
138  public <X, Y> CollectionJoin<X, Y> joinCollection(String attributeName) {
139  return root.joinCollection(attributeName);
140  }
141 
142  @Override
143  public <X, Y> SetJoin<X, Y> joinSet(String attributeName) {
144  return root.joinSet(attributeName);
145  }
146 
147  @Override
148  public <X, Y> ListJoin<X, Y> joinList(String attributeName) {
149  return root.joinList(attributeName);
150  }
151 
152  @Override
153  public <X, K, V> MapJoin<X, K, V> joinMap(String attributeName) {
154  return root.joinMap(attributeName);
155  }
156 
157  @Override
158  public <X, Y> Join<X, Y> join(String attributeName, JoinType jt) {
159  return root.join(attributeName, jt);
160  }
161 
162  @Override
163  public <X, Y> CollectionJoin<X, Y> joinCollection(String attributeName, JoinType jt) {
164  return root.joinCollection(attributeName, jt);
165  }
166 
167  @Override
168  public <X, Y> SetJoin<X, Y> joinSet(String attributeName, JoinType jt) {
169  return root.joinSet(attributeName, jt);
170  }
171 
172  @Override
173  public <X, Y> ListJoin<X, Y> joinList(String attributeName, JoinType jt) {
174  return root.joinList(attributeName, jt);
175  }
176 
177  @Override
178  public <X, K, V> MapJoin<X, K, V> joinMap(String attributeName, JoinType jt) {
179  return root.joinMap(attributeName, jt);
180  }
181 
182  @Override
183  public Path<?> getParentPath() {
184  return root.getParentPath();
185  }
186 
187  @Override
188  public <Y> Path<Y> get(SingularAttribute<? super T, Y> attribute) {
189  return root.get(attribute);
190  }
191 
192  @Override
193  public <E, C extends Collection<E>> Expression<C> get(PluralAttribute<T, C, E> collection) {
194  return root.get(collection);
195  }
196 
197  @Override
198  public <K, V, M extends Map<K, V>> Expression<M> get(MapAttribute<T, K, V> map) {
199  return root.get(map);
200  }
201 
202  @Override
203  public Expression<Class<? extends T>> type() {
204  return root.type();
205  }
206 
207  @Override
208  public <Y> Path<Y> get(String attributeName) {
209  return root.get(attributeName);
210  }
211 
212  @Override
213  public Predicate isNull() {
214  return root.isNull();
215  }
216 
217  @Override
218  public Predicate isNotNull() {
219  return root.isNotNull();
220  }
221 
222  @Override
223  public Predicate in(Object... values) {
224  return root.in(values);
225  }
226 
227  @Override
228  public Predicate in(Expression<?>... values) {
229  return root.in(values);
230  }
231 
232  @Override
233  public Predicate in(Collection<?> values) {
234  return root.in(values);
235  }
236 
237  @Override
238  public Predicate in(Expression<Collection<?>> values) {
239  return root.in(values);
240  }
241 
242  @Override
243  public <X> Expression<X> as(Class<X> type) {
244  return root.as(type);
245  }
246 
247  @Override
248  public Selection<T> alias(String name) {
249  return root.alias(name);
250  }
251 
252  @Override
253  public boolean isCompoundSelection() {
254  return root.isCompoundSelection();
255  }
256 
257  @Override
258  public List<Selection<?>> getCompoundSelectionItems() {
259  return root.getCompoundSelectionItems();
260  }
261 
262  @Override
263  public Class<? extends T> getJavaType() {
264  return root.getJavaType();
265  }
266 
267  @Override
268  public String getAlias() {
269  return root.getAlias();
270  }
271 
272  @Override
273  public Set<Fetch<T, ?>> getFetches() {
274  return root.getFetches();
275  }
276 
277  @Override
278  public <Y> Fetch<T, Y> fetch(SingularAttribute<? super T, Y> attribute) {
279  return root.fetch(attribute);
280  }
281 
282  @Override
283  public <Y> Fetch<T, Y> fetch(SingularAttribute<? super T, Y> attribute, JoinType jt) {
284  return root.fetch(attribute, jt);
285  }
286 
287  @Override
288  public <Y> Fetch<T, Y> fetch(PluralAttribute<? super T, ?, Y> attribute) {
289  return root.fetch(attribute);
290  }
291 
292  @Override
293  public <Y> Fetch<T, Y> fetch(PluralAttribute<? super T, ?, Y> attribute, JoinType jt) {
294  return root.fetch(attribute, jt);
295  }
296 
297  @Override
298  public <X, Y> Fetch<X, Y> fetch(String attributeName) {
299  return root.fetch(attributeName);
300  }
301 
302  @Override
303  public <X, Y> Fetch<X, Y> fetch(String attributeName, JoinType jt) {
304  return root.fetch(attributeName, jt);
305  }
306 
307 }
Set< Join< T, ?> > getJoins()
Definition: JpaRoot.java:68
Class<? extends T > getJavaType()
Definition: JpaRoot.java:263
List< Selection<?> > getCompoundSelectionItems()
Definition: JpaRoot.java:258
Expression< Class<? extends T > > type()
Definition: JpaRoot.java:203
Selection< T > alias(String name)
Definition: JpaRoot.java:248
Predicate in(Expression<?>... values)
Definition: JpaRoot.java:228
EntityType< T > getModel()
Definition: JpaRoot.java:63
Set< Fetch< T, ?> > getFetches()
Definition: JpaRoot.java:273
From< T, T > getCorrelationParent()
Definition: JpaRoot.java:78
Predicate in(Collection<?> values)
Definition: JpaRoot.java:233
Predicate in(Object... values)
Definition: JpaRoot.java:223
Predicate in(Expression< Collection<?>> values)
Definition: JpaRoot.java:238
JpaRoot(Root< T > root)
Definition: JpaRoot.java:54