From a59631069330c480e1ab0fb6743306a5c2c505f7 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Mon, 17 Oct 2016 00:48:57 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- .../java/pw/yumc/YumCore/commands/CommandParse.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/pw/yumc/YumCore/commands/CommandParse.java b/src/main/java/pw/yumc/YumCore/commands/CommandParse.java index 0ebb168..0f19f67 100644 --- a/src/main/java/pw/yumc/YumCore/commands/CommandParse.java +++ b/src/main/java/pw/yumc/YumCore/commands/CommandParse.java @@ -61,7 +61,7 @@ public class CommandParse { return new CommandParse(method.getParameterTypes(), method.getParameterAnnotations(), method.getReturnType().equals(boolean.class)); } - public static void registerParse(Class clazz, Parse parse) { + public static void register(Class clazz, Parse parse) { allparses.put(clazz, parse); } @@ -241,9 +241,6 @@ public class CommandParse { public StringParse() { allparses.put(String.class, this); - if (attrs.containsKey("option")) { - options = Arrays.asList(attrs.get("option").split(",")); - } } @Override @@ -256,5 +253,13 @@ public class CommandParse { } return arg; } + + @Override + public Parse parseAnnotation(Annotation[] annotations) { + if (attrs.containsKey("option")) { + options = Arrays.asList(attrs.get("option").split(",")); + } + return super.parseAnnotation(annotations); + } } }