Package net.sf.oval.context

Examples of net.sf.oval.context.FieldContext


      Model ss = (Model) validatedObject;
     
      try {
              if (context != null) {
                  if (context instanceof FieldContext) {
                      FieldContext ctx = (FieldContext) context;
                      String fieldName = ctx.getField().getName();
                     
                      Query<? extends Object> all = Model.all(validatedObject.getClass());
                List<? extends Object> fetched = all.filter(fieldName, value).fetch();
                if(fetched.size() == 0) return true;
                Object sskey = SienaUtils.findKey(ss);
View Full Code Here


                    }
                    otherKey = to;
                    otherValue = Binder.bind(to, method.getParameterTypes()[index], method.getGenericParameterTypes()[index], method.getParameterAnnotations()[index], Scope.Params.current().all());
                }
                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;
                    }
View Full Code Here

      Model ss = (Model) validatedObject;
     
      try {
              if (context != null) {
                  if (context instanceof FieldContext) {
                      FieldContext ctx = (FieldContext) context;
                      String fieldName = ctx.getField().getName();
                     
                      Query<? extends Object> all = Model.all(validatedObject.getClass());
                List<? extends Object> fetched = all.filter(fieldName, value).fetch();
                if(fetched.size() == 0) return true;
                Object sskey = SienaModelUtils.keyValue(ss);
View Full Code Here

                    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;
                    }
View Full Code Here

                    MethodParameterContext ctx = (MethodParameterContext) context;
                    String[] paramNames = Java.parameterNames(ctx.getMethod());
                    key = paramNames[ctx.getParameterIndex()];
                }
                if (context instanceof FieldContext) {
                    FieldContext ctx = (FieldContext) context;
                    key = ctx.getField().getName();
                }
            }
        } catch (Exception e) {
            throw new UnexpectedException(e);
        }
View Full Code Here

        if (violations.isEmpty()) {
            return true;
        } else {
            for (ConstraintViolation violation : violations) {
                if (violation.getContext() instanceof FieldContext) {
                    final FieldContext ctx = (FieldContext) violation.getContext();
                    final String fkey = (key == null ? "" : key + ".") + ctx.getField().getName();
                    final Error error = new Error(fkey, violation.getMessage(), violation.getMessageVariables() == null ? new String[0] : violation.getMessageVariables().values().toArray(new String[0]));
                    Validation.current().errors.add(error);
                }
            }
            return false;
View Full Code Here

                    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;
                    }
View Full Code Here

                    MethodParameterContext ctx = (MethodParameterContext) context;
                    String[] paramNames = Java.parameterNames(ctx.getMethod());
                    key = paramNames[ctx.getParameterIndex()];
                }
                if (context instanceof FieldContext) {
                    FieldContext ctx = (FieldContext) context;
                    key = ctx.getField().getName();
                }
            }
        } catch (Exception e) {
            throw new UnexpectedException(e);
        }
View Full Code Here

        if (violations.isEmpty()) {
            return true;
        } else {
            for (ConstraintViolation violation : violations) {
                if (violation.getContext() instanceof FieldContext) {
                    final FieldContext ctx = (FieldContext) violation.getContext();
                    final String fkey = (key == null ? "" : key + ".") + ctx.getField().getName();
                    final Error error = new Error(fkey, violation.getMessage(), violation.getMessageVariables() == null ? new String[0] : violation.getMessageVariables().values().toArray(new String[0]));
                    Validation.current().errors.add(error);
                }
            }
            return false;
View Full Code Here

TOP

Related Classes of net.sf.oval.context.FieldContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.