Package br.com.caelum.vraptor.validator

Examples of br.com.caelum.vraptor.validator.ValidationException


    }
    result.include("errors", errors);
    if (Info.isOldComponent(resource.getResource())) {
      info.setResult("invalid");
      result.use(Results.page()).forward();
      throw new ValidationException(new ArrayList<Message>());
    } else {
      return viewsFactory.instanceFor(view, new ArrayList<Message>());
    }
  }
View Full Code Here


    }
    result.include("errors", errors);
    if (Info.isOldComponent(resource.getResource())) {
      info.setResult("invalid");
      result.use(Results.page()).forward();
      throw new ValidationException(new ArrayList<Message>());
    } else {
      return viewsFactory.instanceFor(view, new ArrayList<Message>());
    }
  }
View Full Code Here

    this.proxifier = proxifier;
  }

  public <T extends View> T instanceFor(final Class<T> view, final List<Message> errors) {
    if (view.equals(EmptyResult.class)) {
      throw new ValidationException(errors);
    }

    return proxifier.proxify(view, throwValidationErrorOnFinalMethods(view, errors, result.use(view)));

  }
View Full Code Here

    return new MethodInvocation<T>() {
      public Object intercept(T proxy, Method method, Object[] args, SuperMethod superMethod) {
        final Object instance = new Mirror().on(viewInstance).invoke().method(method).withArgs(args);
        Class type = method.getReturnType();
        if (type == void.class) {
          throw new ValidationException(errors);
        }

        if (view.isAssignableFrom(type)) {
          return proxy;
        }
View Full Code Here

      final T instance) {
    return new MethodInvocation<T>() {
      public Object intercept(Object proxy, Method method, Object[] args, SuperMethod superMethod) {
        new Mirror().on(instance).invoke().method(method).withArgs(args);

        throw new ValidationException(errors);
      }
    };
  }
View Full Code Here

  public void validateProperty(Object object, String property, Class<?>... groups) {
  }

  public <T extends View> T onErrorUse(Class<T> view) {
    if(!this.errors.isEmpty()) {
      throw new ValidationException(errors);
    }
    return new MockResult().use(view);
  }
View Full Code Here

  public void validateProperties(Object object, String... properties) {
  }

  public <T extends View> T onErrorUse(Class<T> view) {
    if(!this.errors.isEmpty()) {
      throw new ValidationException(errors);
    }
    return new MockResult().use(view);
  }
View Full Code Here

  public void validate(Object object) {
  }

  public <T extends View> T onErrorUse(Class<T> view) {
    if(!this.errors.isEmpty()) {
      throw new ValidationException(errors);
    }
    return new MockResult().use(view);
  }
View Full Code Here

    }
    result.include("errors", errors);
    if (Info.isOldComponent(resource.getResource())) {
      info.setResult("invalid");
      result.use(Results.page()).defaultView();
      throw new ValidationException(new ArrayList<Message>());
    } else {
      return viewsFactory.instanceFor(view, new ArrayList<Message>());
    }
  }
View Full Code Here

  public String returnsValue() {
    return "A value";
  }

  public void throwsValidationException() {
    throw new ValidationException(Collections.<Message>emptyList());
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.validator.ValidationException

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.