Skip to content

Package: AttributePredicate$Operator

AttributePredicate$Operator

nameinstructionbranchcomplexitylinemethod
static {...}
M: 124 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 13 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.model.query.predicate;
14:
15: /**
16: * {@link AttributePredicate} definition.
17: *
18: * @param <T> Attribute value type.
19: * @since 1.3.0
20: */
21: public interface AttributePredicate<T> extends QueryPredicate {
22:
23: /**
24: * {@link AttributePredicate}s operators
25: * <p>
26: * Determines how the values of the result set are compared with the given {@link AttributePredicate#getAttributeValue()}
27: *
28: * @since 1.3.0
29: */
30: enum Operator {
31: /**
32: * {@literal #EQUAL} {@link Operator}
33: * <p>
34: * Matches results with the same value.
35: *
36: * @since 1.3.0
37: */
38: EQUAL,
39:
40: /**
41: * {@literal #NOT_EQUAL} {@link Operator}
42: * <p>
43: * Matches results with not the same value.
44: *
45: * @since 1.3.0
46: */
47: NOT_EQUAL,
48:
49: /**
50: * {@literal #IS_NULL} {@link Operator}
51: * <p>
52: * Matches results with value {@code null}.
53: *
54: * @since 1.3.0
55: */
56: IS_NULL,
57: /**
58: * {@literal #NOT_NULL} {@link Operator}
59: * <p>
60: * Matches results with value NOT {@code null}.
61: *
62: * @since 1.3.0
63: */
64: NOT_NULL,
65:
66: /**
67: * {@literal #STARTS_WITH} {@link Operator}
68: * <p>
69: * Matches results with value that starts with the given value.
70: * To be used with {@link String} {@link org.eclipse.kapua.model.KapuaEntityAttributes}.
71: *
72: * @since 1.3.0
73: */
74: STARTS_WITH,
75:
76: /**
77: * The same of {@link #STARTS_WITH} {@link Operator} but case insensitive
78: * <p>
79: * Matches results with value that starts with the given value, case insensitive.
80: * To be used with {@link String} {@link org.eclipse.kapua.model.KapuaEntityAttributes}.
81: *
82: * @since 1.3.0
83: */
84: STARTS_WITH_IGNORE_CASE,
85:
86: /**
87: * {@literal #LIKE} {@link Operator}
88: * <p>
89: * Matches results with value that are like (in SQL fashion) the given value.
90: * To be used with {@link String} {@link org.eclipse.kapua.model.KapuaEntityAttributes}.
91: * <p>
92: * If you want to match only the beginning of the {@link String} please consider using {@link #STARTS_WITH}.
93: *
94: * @since 1.3.0
95: */
96: LIKE,
97:
98: /**
99: * {@link #LIKE} {@link Operator} but case insensitive
100: * <p>
101: * Matches results with value that are like (in SQL fashion) the given value case insensitive.
102: * To be used with {@link String} {@link org.eclipse.kapua.model.KapuaEntityAttributes}.
103: * <p>
104: * If you want to match only the beginning of the {@link String} please consider using {@link #STARTS_WITH_IGNORE_CASE}.
105: *
106: * @since 1.3.0
107: */
108: LIKE_IGNORE_CASE,
109:
110: /**
111: * {@literal #GREATER_THAN} {@link Operator}
112: * <p>
113: * Matches result with value that is greater but not equal.
114: * To be used with {@link Comparable} types.
115: *
116: * @since 1.3.0
117: */
118: GREATER_THAN,
119:
120: /**
121: * {@literal #GREATER_THAN_OR_EQUAL} {@link Operator}
122: * <p>
123: * Matches result with value that is greater or equal.
124: * To be used with {@link Comparable} types.
125: *
126: * @since 1.3.0
127: */
128: GREATER_THAN_OR_EQUAL,
129:
130: /**
131: * {@literal #LESS_THAN} {@link Operator}
132: * <p>
133: * Matches result with value that is less but not equal.
134: * To be used with {@link Comparable} types.
135: *
136: * @since 1.3.0
137: */
138: LESS_THAN,
139:
140: /**
141: * {@literal #LESS_THAN_OR_EQUAL} {@link Operator}
142: * <p>
143: * Matches result with value that is less or equal.
144: * To be used with {@link Comparable} types.
145: *
146: * @since 1.3.0
147: */
148: LESS_THAN_OR_EQUAL
149: }
150:
151: /**
152: * Gets the name of the {@link org.eclipse.kapua.model.KapuaEntityAttributes} to compare.
153: *
154: * @return The name name of the {@link org.eclipse.kapua.model.KapuaEntityAttributes} to compare.
155: * @since 1.3.0
156: */
157: String getAttributeName();
158:
159: /**
160: * Gets the value to compare the results.
161: *
162: * @return The value to compare the results.
163: * @since 1.3.0
164: */
165: T getAttributeValue();
166:
167: /**
168: * Get the {@link Operator} used to compare results.
169: *
170: * @return The {@link Operator} used to compare results.
171: * @since 1.3.0
172: */
173: Operator getOperator();
174: }