How I can do custom Java annotation with no attribute name inside parentheses?
I don’t want this: @annotation_name(att=valor). I just want like in Servlets, i.e:
@WebServlet("/main")
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Define the annotation with an attribute named
value, then the attribute name can be omitted:This can be used like so:
The special attribute name
valueis described in chapter "9.6.1. Annotation Interface Elements" of Java Language Specification: