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

Add missing annotation literals #196

Closed
arjantijms opened this issue Sep 17, 2021 · 0 comments · Fixed by #197
Closed

Add missing annotation literals #196

arjantijms opened this issue Sep 17, 2021 · 0 comments · Fixed by #197
Assignees
Labels
Milestone

Comments

@arjantijms
Copy link
Contributor

Make sure that all appropriate annotation classes in the Security API have a corresponding AnnotationLiteral implementation provided by the API.

The pattern is:

With parameters:

@Qualifier
@Retention(RUNTIME)
public @interface Xyz {

    String foo() default "";
    String bar() default "bla";

    /**
     * <p class="changed_added_4_0">
     * Supports inline instantiation of the {@link Xyz} annotation.
     * </p>
     * 
     * @since 4.0
     */
    public static final class Literal extends AnnotationLiteral<Xyz> implements Xyz {

        private static final long serialVersionUID = 1L;

        public static final Literal INSTANCE = of("", "bla");

        private final String foo;
        private final String bar;

        public static Literal of(String foo, String bar) {
            return new Literal(foo, bar);
        }

        private Literal(String foo, String bar) {
            this.foo = foo;
            this.bar = bar;
        }

        @Override
        public String foo() {
            return foo;
        }

        @Override
        public String bar() {
            return bar;
        }
    }
}

Without parameters:

@Qualifier
@Retention(RUNTIME)
@Target({ TYPE, METHOD, FIELD, PARAMETER })
@Documented
public @interface Xyz {
  
    public static final class Literal extends AnnotationLiteral<Any> implements Xyz {
        private static final long serialVersionUID = 1L;
        public static final Literal INSTANCE = new Literal();
    }
}
@arjantijms arjantijms added the 3.0 label Sep 17, 2021
@arjantijms arjantijms added this to the 3.0 milestone Sep 17, 2021
@arjantijms arjantijms self-assigned this Sep 17, 2021
arjantijms added a commit that referenced this issue Sep 18, 2021
#196 - Add missing annotation literals to interceptor bindings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant