Skip to content

Package: Selection

Selection

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 java.util.List;
18:
19: import cz.cvut.kbss.jopa.model.query.TupleElement;
20:
21: /**
22: * The Selection interface defines an item that is to be returned in a query
23: * result.
24: *
25: * @param <X>
26: * the type of the selection item
27: */
28: public interface Selection<X> extends TupleElement<X> {
29:         /**
30:          * Assigns an alias to the selection item. Once assigned, an alias cannot be
31:          * changed or reassigned. Returns the same selection item.
32:          *
33:          * @param name
34:          * alias
35:          * @return selection item
36:          */
37:         Selection<X> alias(String name);
38:
39:         /**
40:          * Whether the selection item is a compound selection.
41:          *
42:          * @return boolean indicating whether the selection is a
43:          *
44:          * compound selection
45:          */
46:         boolean isCompoundSelection();
47:
48:         /**
49:          * Return the selection items composing a compound selection. Modifications
50:          * to the list do not affect the query.
51:          *
52:          * @return list of selection items
53:          * @throws IllegalStateException
54:          * if selection is not a compound
55:          *
56:          * selection
57:          */
58:         List<Selection<?>> getCompoundSelectionItems();
59: }