This question already has an answer here:
- Adding Java Annotations at Runtime 4 answers
Class MyClass has a numeric field number with annotations.
class MyClass {
@Min(10)
Number number;
}
I would like to use reflection and add a new annotation @Max(20)
to the field on runtime.
How?
I have read an article https://www.baeldung.com/java-reflection-change-annotation-params, I could not find annotationData
. There is not public method see or append or put annotation.
I use open-jdk-10.
I found here. I would like to close my question. Adding Java Annotations at Runtime
Aucun commentaire:
Enregistrer un commentaire