Skip to content
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

Enhancement Proposal: ResourceInfo.getAnnotation(Class annotationClass) #1292

Open
mkarg opened this issue Nov 20, 2024 · 1 comment
Open

Comments

@mkarg
Copy link
Contributor

mkarg commented Nov 20, 2024

I hereby propose the addition of the following method:

public <A extends Annotation> A ResourceInfo.getResourceAnnotations(Class<A> annotationClass)

The idea is that this method returns the annotation instances of the given annotationClass with full respect to the rules found in spec chapter 3.6. This effectively means, this method returns either the super class annotations, or the interface annotations, or the resource class annotations, or the resource method annotations, depending on whether any JAX-RS annotation is found in the particular deeper levels.

The benefit of this method is that there is no need for filters / interceptors to re-implement this algorithm again and again for custom annotations, in case the annotation author wants to apply the same rules as found in chapter 3.6 (hence: the new annotation shall "look and feel" like an official JAX-RS annotation). Implementations could make the already existing algorithm publicly available here, so it is guaranteed that the exact same treatment happens for custom annotations and for official annotations.

@mkarg
Copy link
Contributor Author

mkarg commented Nov 25, 2024

Kindly asking for more opinions, in particular from committers.

If nobody vetos ResourceInfo.getResourceAnnotations upfront, I will provide a PR and compliant implementation (PR for Jersey) in the next weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant