/**
* Returns a listener methods descriptor for the annotated listener, or null if none
* of the class methods are properly annotated.
*/
public JpaEntityListener getEntityListener(Class<?> listenerClass) {
JpaEntityListener listener = new JpaEntityListener();
boolean hasAnnotations = false;
Method[] methods = listenerClass.getDeclaredMethods();
for (int i = 0; i < methods.length; i++) {
if (isValidListenerMethod(methods[i])) {
if (processAnnotations(methods[i], listener)) {
hasAnnotations = true;
}
}
}
if (hasAnnotations) {
listener.setClassName(listenerClass.getName());
return listener;
}
return null;
}