Package javax.validation

Examples of javax.validation.ConstraintViolationException


    }
   
    public< T > void validateBean(final T bean) {
        final Set<ConstraintViolation< T > > violations = doValidateBean(bean);
        if (!violations.isEmpty()) {
            throw new ConstraintViolationException(violations);
        }               
    }
View Full Code Here


        }
        for (Object arg : arguments) {
            validate(violations, arg, clazz, methodClass);
        }
        if (violations.size() > 0) {
            throw new ConstraintViolationException("Failed to validate service: " + clazz.getName() + ", method: " + methodName + ", cause: " + violations, violations);
        }
    }
View Full Code Here

   
    @Override
    public Response toResponse(ValidationException exception) {
        if (exception instanceof ConstraintViolationException) {
           
            final ConstraintViolationException constraint = (ConstraintViolationException) exception;
            final boolean isResponseException = constraint instanceof ResponseConstraintViolationException;
                       
            for (final ConstraintViolation< ? > violation: constraint.getConstraintViolations()) {
                LOG.log(Level.WARNING,
                    violation.getRootBeanClass().getSimpleName()
                    + "." + violation.getPropertyPath()
                    + ": " + violation.getMessage());
            }
View Full Code Here

        final ExecutableValidator methodValidator = getExecutableValidator();
        final Set< ConstraintViolation< T > > violations = methodValidator.validateParameters(instance,
            method, arguments);
       
        if (!violations.isEmpty()) {
            throw new ConstraintViolationException(violations);
        }               
    }
View Full Code Here

    }
   
    public< T > void validateBean(final T bean) {
        final Set<ConstraintViolation< T > > violations = doValidateBean(bean);
        if (!violations.isEmpty()) {
            throw new ConstraintViolationException(violations);
        }               
    }
View Full Code Here

        try {
            persistManager.persistNotValid();
            fail();
        } catch (final EJBException ejbException) {
            assertTrue(ejbException.getCause() instanceof ConstraintViolationException);
            final ConstraintViolationException constraintViolationException = (ConstraintViolationException) ejbException.getCause();
            assertEquals(1, constraintViolationException.getConstraintViolations().size());
        }
    }
View Full Code Here

        ctx.getMethod(),
        ctx.getParameters()
    );

    if ( !violations.isEmpty() ) {
      throw new ConstraintViolationException(
          getMessage( ctx.getMethod(), ctx.getParameters(), violations ),
          violations
      );
    }

    Object result = ctx.proceed();

    violations = validator.forExecutables().validateReturnValue(
        ctx.getTarget(),
        ctx.getMethod(),
        result
    );

    if ( !violations.isEmpty() ) {
      throw new ConstraintViolationException(
          getMessage( ctx.getMethod(), ctx.getParameters(), violations ),
          violations
      );
    }
View Full Code Here

        if (validatorFactory != null) {
            Validator validator = validatorFactory.getValidator();
           
            Set generalSet = validator.validate(adminObject);
            if (!generalSet.isEmpty()) {
                throw new ConstraintViolationException("Constraint violation for AdminObject " + adminObjectClass, generalSet);
            }
        }
        if (adminObject instanceof ResourceAdapterAssociation) {
            if (resourceAdapterWrapper == null) {
                throw new IllegalStateException("Admin object expects to be registered with a ResourceAdapter, but there is no ResourceAdapter");
View Full Code Here

            if (validatorFactory != null) {
                Validator validator = validatorFactory.getValidator();

                Set generalSet = validator.validate(spec);
                if (!generalSet.isEmpty()) {
                    throw new ConstraintViolationException("Constraint violation for ActitvationSpec", generalSet);
                }
            }
            validated = true;
        }
    }
View Full Code Here

        if (validatorFactory != null) {
            Validator validator = validatorFactory.getValidator();
           
            Set generalSet = validator.validate(resourceAdapter);
            if (!generalSet.isEmpty()) {
                throw new ConstraintViolationException("Constraint violation for ResourceAdapter " + resourceAdapterClass, generalSet);
            }
        }
        resourceAdapter.start(bootstrapContext);
    }
View Full Code Here

TOP

Related Classes of javax.validation.ConstraintViolationException

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.