Как получить доступ к параметрам пользовательской аннотации в Java - PullRequest
0 голосов
/ 01 апреля 2019
I have my Custom Annotation  MyAnnotation.
I wanted to access the parameter passed to MyAnnotation.

MyAnnotation.java

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface MyAnnotation {

public String value() default 0;

}

myClient.java

public class myClient{

@MyAnnotation(value=10) 
public int someMethod(int addition){

//Wanted to Access the Value Of Value here which is 10

}

}

Как мы можем получить доступ к значению Value в someMethod ().

...