Package org.vraptor.plugin.hibernate

Examples of org.vraptor.plugin.hibernate.Validate


    public boolean accepts(ResourceMethod method) {
        return method.getMethod().isAnnotationPresent(Validate.class);
    }

    public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException {
        Validate validate = method.getMethod().getAnnotation(Validate.class);
        if (validate != null) {
            ResourceBundle validatorBundle = ResourceBundle.getBundle(
                    "org.hibernate.validator.resources.DefaultValidatorMessages", request.getLocale());
            FallbackResourceBundle bundle = new FallbackResourceBundle(localization.getBundle(), validatorBundle);
            String[] names = provider.parameterNamesFor(method.getMethod());
            for (String path : validate.params()) {
                try {
                    Object[] paramValues = parameters.getParameters();
                    Object object = paramFor(names, path, paramValues);
                    BasicValidationErrors newErrors = new BasicValidationErrors();
                    HibernateLogicMethod.validateParam(locator, request, bundle, newErrors, object, path);
View Full Code Here


            if (method.isAnnotationPresent(Logic.class)) {
                logger.warn("Method " + method.getName() + " from " + originalType.getName()
                        + " is annotated with @Logic. Although its supported, we suggest you to migrate to @Path.");
            }
            if (method.isAnnotationPresent(Validate.class)) {
                Validate validate = method.getAnnotation(Validate.class);
                if (validate.fields().length != 0) {
                    logger.error("Method " + method.getName() + " from " + originalType.getName()
                            + " is annotated with @Validate with fields. This is not supported.");
                }
            }
        }
View Full Code Here

        }
    }

  private void checkValidate(Class<?> type, Method method) {
    if (method.isAnnotationPresent(Validate.class)) {
        Validate validate = method.getAnnotation(Validate.class);
        if (validate.fields().length != 0) {
            logger.error("Method " + method.getName() + " from " + type.getName()
                    + " is annotated with @Validate with fields. This is not supported.");
        }
    }
  }
View Full Code Here

    public boolean accepts(ResourceMethod method) {
        return method.getMethod().isAnnotationPresent(Validate.class);
    }

    public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException {
        Validate validate = method.getMethod().getAnnotation(Validate.class);
        if (validate != null) {
            ResourceBundle validatorBundle = ResourceBundle.getBundle(
                    "org.hibernate.validator.resources.DefaultValidatorMessages", request.getLocale());
            FallbackResourceBundle bundle = new FallbackResourceBundle(localization.getBundle(), validatorBundle);
            String[] names = provider.parameterNamesFor(method.getMethod());
            for (String path : validate.params()) {
                try {
                    Object[] paramValues = parameters.getParameters();
                    Object object = paramFor(names, path, paramValues);
                    BasicValidationErrors newErrors = new BasicValidationErrors();
                    HibernateLogicMethod.validateParam(locator, request, bundle, newErrors, object, path);
View Full Code Here

    public boolean accepts(ResourceMethod method) {
        return method.getMethod().isAnnotationPresent(Validate.class);
    }

    public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException {
        Validate validate = method.getMethod().getAnnotation(Validate.class);
        if (validate != null) {
            ResourceBundle validatorBundle = ResourceBundle.getBundle(
                    "org.hibernate.validator.resources.DefaultValidatorMessages", request.getLocale());
            FallbackResourceBundle bundle = new FallbackResourceBundle(localization.getBundle(), validatorBundle);
            String[] names = provider.parameterNamesFor(method.getMethod());
            for (String path : validate.params()) {
                try {
                    Object[] paramValues = parameters.getParameters();
                    Object object = paramFor(names, path, paramValues);
                    BasicValidationErrors newErrors = new BasicValidationErrors();
                    HibernateLogicMethod.validateParam(locator, request, bundle, newErrors, object, path);
View Full Code Here

            if (method.isAnnotationPresent(Logic.class)) {
                logger.warn("Method " + method.getName() + " from " + originalType.getName()
                        + " is annotated with @Logic. Although its supported, we suggest you to migrate to @Path.");
            }
            if (method.isAnnotationPresent(Validate.class)) {
                Validate validate = method.getAnnotation(Validate.class);
                if (validate.fields().length != 0) {
                    logger.error("Method " + method.getName() + " from " + originalType.getName()
                            + " is annotated with @Validate with fields. This is not supported.");
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.vraptor.plugin.hibernate.Validate

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.