Skip to content

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

@mkarg

Description

@mkarg

I hereby propose the addition of the following method:

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

The idea is that this method returns the annotation instance 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 annotation, or the interface annotation, or the resource class annotation, or the resource method annotation, 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions