Package br.com.caelum.vraptor

Examples of br.com.caelum.vraptor.VRaptorException


    Object current = root;
    for (String p : paths) {
      try {
        current = navigate(current, p);
      } catch (InvocationTargetException e) {
        throw new VRaptorException("Unable to evaluate expression " + path, e.getCause());
      } catch (Exception e) {
        throw new VRaptorException("Unable to evaluate expression " + path, e);
      }
      if (current == null) {
        return "";
      }
    }
View Full Code Here


        it.next();
      }
      return it.next();
    }
    String msg = "Unable to access position of a" + current.getClass().getName() + ".";
    throw new InvocationTargetException(new VRaptorException(msg), msg);
  }
View Full Code Here

    List<Migration> migrations = new ArrayList<Migration>();
    for (Class<? extends Migration> type : migrationTypes) {
      try {
        migrations.add(type.getConstructor().newInstance());
      } catch (Exception e) {
        throw new VRaptorException("Cannot instantiate migration: ", e);
      }
    }
    return migrations;
  }
View Full Code Here

    if (Interceptor.class.isAssignableFrom(type)) {
            registerInterceptor(type);
        } else if (InterceptorSequence.class.isAssignableFrom(type)) {
            registerInterceptorSequence(type);
        } else {
            throw new VRaptorException("Annotation " + Intercepts.class + " found in " + type
                    + ", but it is neither an Interceptor nor an InterceptorSequence.");
        }
  }
View Full Code Here

      for (Class<? extends Interceptor> interceptor : interceptors) {
        componentRegistry.deepRegister(interceptor);
      }
      return interceptors;
    } catch (Exception e) {
      throw new VRaptorException("Problem ocurred while instantiating an interceptor sequence", e);
    }
  }
View Full Code Here

    this.converters = converters;
  }

  public void handle(Class<?> annotatedType) {
    if (!(Converter.class.isAssignableFrom(annotatedType)))
      throw new VRaptorException("converter does not implement Converter");
   
    @SuppressWarnings("unchecked")
    Class<? extends Converter<?>> converterType = (Class<? extends Converter<?>>) annotatedType;
   
    converters.register(converterType);
View Full Code Here

    Method listSetter = ReflectionBasedNullHandler.findMethod(listHolder.getClass(), "set"
        + Info.capitalize(listPropertyName), target.getClass(), null);
    Type[] types = listSetter.getGenericParameterTypes();
    Type type = types[0];
    if (!(type instanceof ParameterizedType)) {
      throw new VRaptorException("Vraptor does not support non-generic collection at "
          + listSetter.getName());
    }
    Class typeToInstantiate = (Class) ((ParameterizedType) type).getActualTypeArguments()[0];
    Constructor constructor = typeToInstantiate.getDeclaredConstructor();
    constructor.setAccessible(true);
View Full Code Here

        }
      }
      try {
        setter.set(newArray);
      } catch (InvocationTargetException e) {
        throw new VRaptorException(e.getCause());
      } catch (Exception e) {
        throw new IllegalArgumentException(e);
      }
    }
  }
View Full Code Here

        logger.info("Registering all custom converters annotated with @Convert");
        Collection<Class<?>> converterTypes = scanner.getTypesWithAnnotation(Convert.class);

        for (Class<?> converterType : converterTypes) {
            if (!Converter.class.isAssignableFrom(converterType)) {
                throw new VRaptorException("converter " + converterType + "does not implement Converter");
            }
            logger.debug("found converter: " + converterType);
            converters.register((Class<? extends Converter<?>>) converterType);
        }
    }
View Full Code Here

                registry.register((Class<? extends Interceptor>) interceptorType);
            } else if (InterceptorSequence.class.isAssignableFrom(interceptorType)) {
                logger.debug("Found interceptor sequence for " + interceptorType);
                registry.register(parseSequence((Class<? extends InterceptorSequence>) interceptorType));
            } else {
                throw new VRaptorException("Annotation " + Intercepts.class + " found in " + interceptorType
                        + ", but it is neither an Interceptor nor an InterceptorSequence.");
            }
        }

    }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.VRaptorException

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.