1 package com.atlassian.plugin.event.impl;
2
3 import org.apache.commons.lang3.StringUtils;
4
5 import java.lang.reflect.Method;
6
7
8
9
10 public class MethodNameListenerMethodSelector implements ListenerMethodSelector {
11 private final String methodName;
12
13 public MethodNameListenerMethodSelector() {
14 this("channel");
15 }
16
17 public MethodNameListenerMethodSelector(String s) {
18 if (StringUtils.isEmpty(s))
19 throw new IllegalArgumentException("Method name for the listener must be a valid method name");
20 this.methodName = s;
21 }
22
23
24
25
26
27
28
29
30 public boolean isListenerMethod(Method method) {
31 if (method == null)
32 throw new IllegalArgumentException("Method cannot be null");
33
34 return methodName.equals(method.getName());
35 }
36 }