Added support for position in ConfigItem
This commit is contained in:
@@ -33,6 +33,8 @@ import java.lang.annotation.Target;
|
|||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
public @interface ConfigItem
|
public @interface ConfigItem
|
||||||
{
|
{
|
||||||
|
int position() default -1;
|
||||||
|
|
||||||
String keyName();
|
String keyName();
|
||||||
|
|
||||||
String name();
|
String name();
|
||||||
|
|||||||
@@ -312,6 +312,12 @@ public class ConfigManager
|
|||||||
|
|
||||||
List<ConfigItemDescriptor> items = Arrays.stream(inter.getMethods())
|
List<ConfigItemDescriptor> items = Arrays.stream(inter.getMethods())
|
||||||
.filter(m -> m.getParameterCount() == 0)
|
.filter(m -> m.getParameterCount() == 0)
|
||||||
|
.sorted((m1, m2) ->
|
||||||
|
Integer.compare(
|
||||||
|
m1.getDeclaredAnnotation(ConfigItem.class).position(),
|
||||||
|
m2.getDeclaredAnnotation(ConfigItem.class).position()
|
||||||
|
)
|
||||||
|
)
|
||||||
.map(m -> new ConfigItemDescriptor(
|
.map(m -> new ConfigItemDescriptor(
|
||||||
m.getDeclaredAnnotation(ConfigItem.class),
|
m.getDeclaredAnnotation(ConfigItem.class),
|
||||||
m.getReturnType()
|
m.getReturnType()
|
||||||
|
|||||||
Reference in New Issue
Block a user