boolean found = map.get( "domainValidation" ) != null;
boolean sameLevel = false;
boolean noArgs = false;
if (found) {
AnnotationData ad = (AnnotationData) map.get( "domainValidation" );
Object parentReference = ad.getValues().get("parentProperty");
Object validator = null;
if ((parentReference != null) && (!"".equals(parentReference))) {
// If the parentProperty is specified, then find the parent class
BeanWrapper wrapper = new BeanWrapperImpl(child);
validator = wrapper.getPropertyValue( (String)parentReference );
} else {
// Otherwise, the validation method is assumed to be in the child
validator = child;
sameLevel = true;
}
noArgs = (Boolean) ad.getValues().get("global");
// Make sure the method exists
Method m = null;
if (validator != null) {
try {
String methodName = (String)ad.getValues().get("method");
if (noArgs) {
m = validator.getClass().getDeclaredMethod(methodName);
} else if (sameLevel) {
Class[] parameters=new Class[1];