Background:
The order of Class.getDeclaredFields() is not specified in Java, so I want to add annotations to fields to indicate order of field like this:
public final class Model {
@Order(1)
String item1;
@Order(2)
String item2;
@Order(3)
String item3;
@Order(4)
String item4;
}
But it is too tough to add these annotations to all classes.
Question:
Is there any way to add annotations to indicate the order of the fields automatically?
I had a look around the document of Lombok, but there is no feature like that.
Aucun commentaire:
Enregistrer un commentaire