Skip to content

Package: Selection

Selection

Coverage

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