Skip to content

Commit

Permalink
Ensure fields annotated by @position are sorted by @position value an…
Browse files Browse the repository at this point in the history
…d not by definition order
  • Loading branch information
hypfvieh committed Oct 30, 2024
1 parent 80defd8 commit 09ba07e
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ private void createReturnArguments(Method _meth, StringBuilder _sb) throws DBusE
argTypes = Arrays.stream(clz.getDeclaredFields())
.filter(f -> f.isAnnotationPresent(Position.class))
.filter(Objects::nonNull)
.map(f -> Map.entry(f.getAnnotation(Position.class).value(), f))
.sorted(Comparator.comparingInt(k -> k.getKey()))
.map(f -> f.getValue())
.map(Field::getType)
.map(Type.class::cast)
.toList();
Expand Down

0 comments on commit 09ba07e

Please sign in to comment.