If I have a parametrized annotation which is used on a field, can the object referenced by the field access the annotation parameter?
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Classy {
Class<?> klazz();
}
usage:
class Bar{
@Classy(klazz=Integer.class)
Foo foo;
...
}
hypothetical access:
class Foo{
private Class<?> klazz = String.class;
private void useAnnotationParameterIfAvailable(){
klazz = what goes here?
}
}
Thank you