Added xml support for event listener and made minor cleanup
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package org.baeldung.event;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
public class FieldCallback implements ReflectionUtils.FieldCallback {
|
||||
private boolean idFound;
|
||||
|
||||
public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
|
||||
ReflectionUtils.makeAccessible(field);
|
||||
|
||||
if (field.isAnnotationPresent(Id.class)) {
|
||||
idFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isIdFound() {
|
||||
return idFound;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user