aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-12-23 11:09:03 +0300
committerGravatar Vitaly Takmazov2016-12-23 11:09:03 +0300
commit97f993fad0dea34b25cb5da932920971627fd972 (patch)
treef90bba88b108eeb420e07b4f191c4f9e1dfd20a0 /juick-server/src/main/java/com/juick/server
parenta6aa01258352a4053d55727c974492ffe27f1fcc (diff)
juick-protocol: using MethodUtils
Diffstat (limited to 'juick-server/src/main/java/com/juick/server')
-rw-r--r--juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java4
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();