Hi
I have created many annotation in my life and now came to strange case that i need this annotation to do and dont think it is supported by Java at all. Please someone tell me that i am right or wrong.
Here is my annotation :
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface DetailsField {
public String name();
}
And now the question! I would like that the default value of the name() function would be the name of the field it self where I have posted the annotation.
Dont know exactly how the classloader processes the annotations, i am pretty sure that this is not implemented in a standard classloader , but could be maybe achieved by bytecode instrumentation in the time of classloading by a custom classloader ? (I am pretty sure if this is the only solution i would find a way around , just curious )
Any ideas? Or do i wish too much ?