|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2024 Contributors to the Eclipse Foundation |
| 2 | + * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
22 | 22 | import java.lang.annotation.RetentionPolicy;
|
23 | 23 | import java.lang.annotation.Target;
|
24 | 24 |
|
| 25 | +import jakarta.data.metamodel.restrict.Operator; |
| 26 | + |
25 | 27 | /**
|
26 | 28 | * <p>Annotates a parameter of a repository {@link Find} or {@link Delete} method,
|
27 | 29 | * indicating how a persistent field is compared against the parameter's value.
|
|
42 | 44 | *
|
43 | 45 | * // Find a page of Product entities where the name field matches a pattern, ignoring case.
|
44 | 46 | * @Find
|
45 |
| - * Page<Product> search(@By(_Product.NAME) @Is(LIKE_ANY_CASE) String pattern, |
| 47 | + * Page<Product> search(@By(_Product.NAME) @Is(LIKE) @IgnoreCase String pattern, |
46 | 48 | * PageRequest pagination,
|
47 | 49 | * Order<Product> order);
|
48 | 50 | *
|
|
67 | 69 | * <pre>
|
68 | 70 | * @Find
|
69 | 71 | * @OrderBy(_Person.YEAR_BORN)
|
70 |
| - * List<Person> bornWithin(@By(_Person.YEAR_BORN) @Is(GREATER_THAN_EQ) float minYear, |
71 |
| - * @By(_Person.YEAR_BORN) @Is(LESS_THAN_EQ) float maxYear); |
| 72 | + * List<Person> bornWithin(@By(_Person.YEAR_BORN) @Is(GREATER_THAN_EQUAL) float minYear, |
| 73 | + * @By(_Person.YEAR_BORN) @Is(LESS_THAN_EQUAL) float maxYear); |
72 | 74 | * </pre>
|
73 | 75 | *
|
74 |
| - * <p>The default comparison operation is the {@linkplain #EQUAL equality} |
| 76 | + * <p>The default comparison operation is the {@linkplain Operator#EQUAL equality} |
75 | 77 | * comparison.</p>
|
76 | 78 | *
|
77 | 79 | * <p>For concise code, it can be convenient for a repository interface to
|
78 | 80 | * statically import one or more constants from this class. For example:</p>
|
79 | 81 | *
|
80 | 82 | * <pre>
|
81 |
| - * import static jakarta.data.repository.Is.Op.*; |
| 83 | + * import static jakarta.data.metamodel.restrict.Operator.*; |
82 | 84 | * </pre>
|
83 | 85 | *
|
84 | 86 | * @return the type of comparison operation.
|
85 | 87 | */
|
86 |
| - Op value() default Op.EQUAL; |
87 |
| - |
88 |
| - /** |
89 |
| - * <p>Comparison operations for the {@link Is} annotation.</p> |
90 |
| - * |
91 |
| - * <p>For more concise code, it can be convenient to statically import one |
92 |
| - * or more comparison operations. For example:</p> |
93 |
| - * |
94 |
| - * <pre> |
95 |
| - * import static jakarta.data.repository.Is.Op.*; |
96 |
| - * </pre> |
97 |
| - */ |
98 |
| - public static enum Op { |
99 |
| - // TODO add JavaDoc with examples to these |
100 |
| - ANY_CASE, |
101 |
| - EQUAL, |
102 |
| - GREATER_THAN, |
103 |
| - GREATER_THAN_ANY_CASE, |
104 |
| - GREATER_THAN_EQ, |
105 |
| - GREATER_THAN_EQ_ANY_CASE, |
106 |
| - IN, |
107 |
| - LESS_THAN, |
108 |
| - LESS_THAN_ANY_CASE, |
109 |
| - LESS_THAN_EQ, |
110 |
| - LESS_THAN_EQ_ANY_CASE, |
111 |
| - LIKE, |
112 |
| - LIKE_ANY_CASE, |
113 |
| - PREFIXED, |
114 |
| - PREFIXED_ANY_CASE, |
115 |
| - SUBSTRINGED, |
116 |
| - SUBSTRINGED_ANY_CASE, |
117 |
| - SUFFIXED, |
118 |
| - SUFFIXED_ANY_CASE, |
119 |
| - NOT, |
120 |
| - NOT_ANY_CASE, |
121 |
| - NOT_IN, |
122 |
| - NOT_LIKE, |
123 |
| - NOT_LIKE_ANY_CASE, |
124 |
| - NOT_PREFIXED, |
125 |
| - NOT_PREFIXED_ANY_CASE, |
126 |
| - NOT_SUBSTRINGED, |
127 |
| - NOT_SUBSTRINGED_ANY_CASE, |
128 |
| - NOT_SUFFIXED, |
129 |
| - NOT_SUFFIXED_ANY_CASE; |
130 |
| - } |
| 88 | + Operator value() default Operator.EQUAL; |
131 | 89 | }
|
0 commit comments