mardi 25 juin 2019

Annotate inherited fields in anonymous class

Lets suppose i have a class:

public class Foo {

    int a;
    int b;

}

And i'm creating an object of anonymouse class. The question is that is it technically possibile to set annotation on inherited fields a and b like below but in run time?

Foo anonymouse = new Foo() {
    @Annotation
    int a;
    @Annotation
    int b;

}





Aucun commentaire:

Enregistrer un commentaire