This question already has an answer here:
I need to get the returned value of any method annotated with an specific enum in a class using Reflection. How can I accomplish that?
I know that a have to create a custom annotation that receive a Type as parameter, but I don't know what else I have to do.
ex.:
enum Type{ TYPE1, TYPE2, TYPE3}
public class MyClass{
@MyCustomAnnotation(type=Type.TYPE1)
public int myMethod1(){return 1;}
@MyCustomAnnotation(type=Type.TYPE2)
public int myMethod2(){return 2;}
}
Aucun commentaire:
Enregistrer un commentaire