Skip to content

Package: FetchParent

FetchParent

Coverage

1: /**
2: * Copyright (C) 2016 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.jopa.model.query.criteria;
16:
17: import cz.cvut.kbss.jopa.model.metamodel.PluralAttribute;
18: import cz.cvut.kbss.jopa.model.metamodel.SingularAttribute;
19:
20: /**
21: * Represents an element of the from clause which may function as the parent of
22: * Fetches.
23: *
24: * @param <Z>
25: * the source type
26: * @param <X>
27: * the target type
28: */
29: public interface FetchParent<Z, X> {
30:         /**
31:          * Return the fetch joins that have been made from this type. Returns empty
32:          * set if no fetch joins have been made from this type. Modifications to the
33:          * set do not affect the query.
34:          *
35:          * @return fetch joins made from this type
36:          */
37:         java.util.Set<Fetch<X, ?>> getFetches();
38:
39:         /**
40:          * Create a fetch join to the specified single-valued attribute using an
41:          * inner join.
42:          *
43:          * @param attribute
44:          * target of the join
45:          * @return the resulting fetch join
46:          **/
47:         <Y> Fetch<X, Y> fetch(SingularAttribute<? super X, Y> attribute);
48:
49:         /**
50:          * Create a fetch join to the specified single-valued attribute using the
51:          * given join type.
52:          *
53:          * @param attribute
54:          * target of the join
55:          * @param jt
56:          * join type
57:          * @return the resulting fetch join
58:          **/
59:         <Y> Fetch<X, Y> fetch(SingularAttribute<? super X, Y> attribute, JoinType jt);
60:
61:         /**
62:          * Create a fetch join to the specified collection-valued attribute using an
63:          * inner join.
64:          *
65:          * @param attribute
66:          * target of the join
67:          * @return the resulting join
68:          **/
69:         <Y> Fetch<X, Y> fetch(PluralAttribute<? super X, ?, Y> attribute);
70:
71:         /**
72:          * Create a fetch join to the specified collection-valued attribute using
73:          * the given join type.
74:          *
75:          * @param attribute
76:          * target of the join
77:          * @param jt
78:          * join type
79:          * @return the resulting join
80:          **/
81:         <Y> Fetch<X, Y> fetch(PluralAttribute<? super X, ?, Y> attribute,
82:                         JoinType jt);
83:
84:         // String-based:
85:         /**
86:          * Create a fetch join to the specified attribute using an inner join.
87:          *
88:          * @param attributeName
89:          * name of the attribute for the target of the join
90:          * @return the resulting fetch join
91:          * @throws IllegalArgumentException
92:          * if attribute of the given name does not exist
93:          **/
94:         <Y> Fetch<X, Y> fetch(String attributeName);
95:
96:         /**
97:          * Create a fetch join to the specified attribute using the given join type.
98:          *
99:          * @param attributeName
100:          * name of the attribute for the target of the join
101:          * @param jt
102:          * join type
103:          * @return the resulting fetch join
104:          * @throws IllegalArgumentException
105:          * if attribute of the given name does not exist
106:          **/
107:         <Y> Fetch<X, Y> fetch(String attributeName, JoinType jt);
108: }