public boolean isSatisfied(Object validatedObject, Object value, OValContext context, Validator validator) {
requireMessageVariablesRecreation();
try {
if (context != null) {
if (context instanceof MethodParameterContext) {
MethodParameterContext ctx = (MethodParameterContext) context;
Method method = ctx.getMethod();
String[] paramNames = Java.parameterNames(method);
int index = -1;
for (int i = 0; i < paramNames.length; i++) {
if (paramNames[i].equals(to)) {
index = i;
break;
}
}
if (index < 0) {
return false;
}
otherKey = to;
RootParamNode rootParamNode = Scope.Params.current().getRootParamNode();
Class<?> clazz = method.getParameterTypes()[index];
Type type = method.getGenericParameterTypes()[index];
otherValue = Binder.bind(rootParamNode, to, clazz, type, method.getParameterAnnotations()[index]);
}
if (context instanceof FieldContext) {
FieldContext ctx = (FieldContext) context;
try {
Field otherField = ctx.getField().getDeclaringClass().getDeclaredField(to);
otherKey = to;
otherValue = otherField.get(validatedObject);
} catch (Exception e) {
return false;
}