Skip to content

Package: Expression

Expression

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.Collection;
18:
19: /**
20: * Type for query expressions.
21: *
22: * @param <T>
23: * the type of the expression
24: */
25: public interface Expression<T> extends Selection<T> {
26:         /**
27:          * Create a predicate to test whether the expression is null.
28:          *
29:          * @return predicate testing whether the expression is null
30:          */
31:         Predicate isNull();
32:
33:         /**
34:          * Create a predicate to test whether the expression is not null.
35:          *
36:          * @return predicate testing whether the expression is not null
37:          */
38:         Predicate isNotNull();
39:
40:         /**
41:          * Create a predicate to test whether the expression is a member of the
42:          * argument list.
43:          *
44:          * @param values
45:          * values to be tested against
46:          * @return predicate testing for membership
47:          */
48:         Predicate in(Object... values);
49:
50:         /**
51:          * Create a predicate to test whether the expression is a member of the
52:          * argument list.
53:          *
54:          * @param values
55:          * expressions to be tested against
56:          * @return predicate testing for membership
57:          */
58:         Predicate in(Expression<?>... values);
59:
60:         /**
61:          * Create a predicate to test whether the expression is a member of the
62:          * collection.
63:          *
64:          * @param values
65:          * collection of values to be tested against
66:          * @return predicate testing for membership
67:          */
68:         Predicate in(Collection<?> values);
69:
70:         /**
71:          * Create a predicate to test whether the expression is a member of the
72:          * collection.
73:          *
74:          * @param values
75:          * expression corresponding to collection to be
76:          *
77:          * tested against
78:          * @return predicate testing for membership
79:          */
80:         Predicate in(Expression<Collection<?>> values);
81:
82:         /**
83:          * Perform a typecast upon the expression, returning a new expression
84:          * object. This method does not cause type conversion: the runtime type is
85:          * not changed. Warning: may result in a runtime failure.
86:          *
87:          * @param type
88:          * intended type of the expression
89:          * @return new expression of the given type
90:          */
91:         <X> Expression<X> as(Class<X> type);
92: }