-
Notifications
You must be signed in to change notification settings - Fork 36
Case insensitive Constraints via IgnoreCase annotation #1005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
njr-11
wants to merge
1
commit into
jakartaee:main
Choose a base branch
from
njr-11:case-insensitive-constraints-option-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| /* | ||
| * Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| package jakarta.data.repository; | ||
|
|
||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
|
|
||
| import jakarta.data.constraint.AtLeast; | ||
| import jakarta.data.constraint.AtMost; | ||
| import jakarta.data.constraint.Between; | ||
| import jakarta.data.constraint.EqualTo; | ||
| import jakarta.data.constraint.GreaterThan; | ||
| import jakarta.data.constraint.LessThan; | ||
| import jakarta.data.constraint.Like; | ||
| import jakarta.data.constraint.NotBetween; | ||
| import jakarta.data.constraint.NotEqualTo; | ||
| import jakarta.data.constraint.NotLike; | ||
|
|
||
| /** | ||
| * <p>Annotates a parameter of a repository {@link Find} or {@link Delete} | ||
| * method, to compare an entity attribute ignoring case.</p> | ||
| * | ||
| * <p>The parameter must correspond to a {@link String}-typed entity attribute | ||
| * and must either be an implicit equality constraint or one of the following | ||
| * constraints, indicated by the method parameter's type or its {@link Is @Is} | ||
| * annotation. | ||
| * | ||
| * <ul> | ||
| * <li>{@link AtLeast}</li> | ||
| * <li>{@link AtMost}</li> | ||
| * <li>{@link Between} (not available for {@code @Is})</li> | ||
| * <li>{@link EqualTo}</li> | ||
| * <li>{@link GreaterThan}</li> | ||
| * <li>{@link LessThan}</li> | ||
| * <li>{@link Like}</li> | ||
| * <li>{@link NotBetween} (not available for {@code @Is})</li> | ||
| * <li>{@link NotEqualTo}</li> | ||
| * <li>{@link NotLike}</li> | ||
| * </ul> | ||
| * | ||
| * <p>For example,</p> | ||
| * | ||
| * <pre> | ||
| * @Repository | ||
| * public interface People extends BasicRepository<Person, Long> { | ||
| * | ||
| * // List of Person entities where the lastName attribute matches a | ||
| * // literal value, ignoring case. | ||
| * // Requires the -parameters compile option. | ||
| * @Find | ||
| * List<Person> ofSurname(@IgnoreCase String lastName); | ||
| * | ||
| * // List of Person entities where the lastName attribute matches a | ||
| * // pattern, ignoring case. | ||
| * @Find | ||
| * @OrderBy(_Person.LASTNAME) | ||
| * @OrderBy(_Person.FIRSTNAME) | ||
| * List<Person> surnamed(@By(_Person.LASTNAME) @IgnoreCase Like pattern); | ||
| * | ||
| * // List of Person entities where the lastName attribute, is alphabetized | ||
| * // within the first parameter up to but not including the second | ||
| * // parameter, ignoring case. | ||
| * @Find | ||
| * @OrderBy(_Person.LASTNAME) | ||
| * @OrderBy(_Person.FIRSTNAME) | ||
| * List<Person> withinSurnameRange( | ||
| * @By(_Person.LASTNAME) @IgnoreCase @Is(AtLeast.class) String beginAt, | ||
| * @By(_Person.LASTNAME) @IgnoreCase @Is(LessThan.class) String endBefore); | ||
| * } | ||
| * | ||
| * ... | ||
| * | ||
| * smiths = people.ofSurname("smith"); | ||
| * aNames = people.surnamed(Like.pattern("A%")); | ||
| * surnamesAToE = people.withinSurnameRange("A", "F"); | ||
| * </pre> | ||
| */ | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target(ElementType.PARAMETER) | ||
| public @interface IgnoreCase { | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, just update to use Javadoc code tag :)