diff options
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/protocol')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java b/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java index cd7a4bc1..be68fe62 100644 --- a/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java +++ b/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java @@ -10,6 +10,7 @@ import com.juick.service.*; import com.juick.util.TagUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; +import org.apache.commons.lang3.reflect.MethodUtils; import javax.inject.Inject; import java.lang.reflect.InvocationTargetException; @@ -61,8 +62,7 @@ public class JuickProtocol { */ public ProtocolReply getReply(User user, String userInput) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException { - Optional<Method> cmd = Arrays.stream(getClass().getDeclaredMethods()) - .filter(m -> m.isAnnotationPresent(UserCommand.class)) + Optional<Method> cmd = MethodUtils.getMethodsListWithAnnotation(getClass(), UserCommand.class).stream() .filter(m -> Pattern.compile(m.getAnnotation(UserCommand.class).pattern(), m.getAnnotation(UserCommand.class).patternFlags()).matcher(userInput).matches()) .findFirst(); |