Used to declare fields order as metadata instead of method.
example:
// New
@FieldOrder({ "n", "s" })
class Parent extends Structure {
public int n;
public String s;
}
@FieldOrder({ "d", "c" })
class Son extends Parent {
public double d;
public char c;
}
// Old
class Parent extends Structure {
public int n;
public String s;
protected List getFieldOrder() {
return Arrays.asList("n", "s");
}
}
class Son extends Parent {
public double d;
public char c;
protected List getFieldOrder() {
List fields = new LinkedList(super.getFieldOrder());
fields.addAll(Arrays.asList("d", "c"));
return fields;
}
}