private Method getAddListenerMethod(
Class<? extends Component> componentClass, Class<?> eventClass) {
List<Method> addListenerCandidates = findMethods(componentClass,
"add(.*)Listener", ParamCount.constant(1));
Collections.sort(addListenerCandidates, new MethodComparator());
for (Method addListenerCandidate : addListenerCandidates) {
// Check if this method accepts correct type of listeners.
Class<?> listenerInterface = addListenerCandidate
.getParameterTypes()[0];