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