Creating java class with annotated fields in runtime
- by Sarmun
The problem is that I need to create in runtime a class like this:
public class Foo {
@Bar int value0;
@Bar int value1;
@Bar int value2;
....
}
with number of fields being decided at runtime.
I was looking at Javassist, and there you can create a new class, and add fields to it, but I haven't found a way to annotate those fields.