()
| 985 | */ |
| 986 | // TODO(idosu 28 Apr 2018): Maybe deprecate this method to let users know they should use @FieldOrder |
| 987 | protected List<String> getFieldOrder() { |
| 988 | List<String> fields = new LinkedList<>(); |
| 989 | for (Class<?> clazz = getClass(); clazz != Structure.class; clazz = clazz.getSuperclass()) { |
| 990 | FieldOrder order = clazz.getAnnotation(FieldOrder.class); |
| 991 | if (order != null) { |
| 992 | fields.addAll(0, Arrays.asList(order.value())); |
| 993 | } |
| 994 | } |
| 995 | |
| 996 | // fields.isEmpty() can be true because it is check somewhere else |
| 997 | return Collections.unmodifiableList(fields); |
| 998 | } |
| 999 | |
| 1000 | /** Sort the structure fields according to the given array of names. |
| 1001 | * @param fields list of fields to be sorted |
no outgoing calls