public static List < ExecutableElement > getSortedAnnotationMembers ( TypeElement annotation ) { List < ExecutableElement > members = Lists . newArrayList ( getMethods ( annotation ) ) ; Collections . sort ( members , ( m1 , m2 ) -> getName ( m1 ) . compareTo ( getName ( m2 ) ) ) ; return members ; }
Returns an alphabetically sorted list of an annotation type s members . This is necessary since an annotation s values can be specified in any order but the annotation s constructor needs to be invoked using its declaration order .