Package org.apache.bval

Examples of org.apache.bval.BeanValidationContext


      return;
    }

    // process composed constraints
    if (isReportAsSingleViolation()) {
      BeanValidationContext gctx = (BeanValidationContext) context;
      ConstraintValidationListener oldListener =
          ((ConstraintValidationListener) gctx.getListener());
      ConstraintValidationListener listener =
          new ConstraintValidationListener(oldListener.getRootBean(), oldListener.getRootBeanType());
      gctx.setListener(listener);
      try {
        for (ConstraintValidation composed : getComposingValidations()) {
          composed.validate(context);
        }
      } finally {
        gctx.setListener(oldListener);
      }

      // Restore current constraint validation
      context.setConstraintValidation(this);
View Full Code Here


        super.tearDown();
    }

    public void testValidationResults() throws Exception {
        assertTrue(results.isEmpty());
        BeanValidationContext ctx = new BeanValidationContext(results);
        ctx.setBean(this);
        ctx.setMetaProperty(new MetaProperty());
        ctx.getMetaProperty().setName("prop");
        results.addError("test", ctx);
        assertFalse(results.isEmpty());
        assertTrue(results.hasErrorForReason("test"));
        assertTrue(results.hasError(this, "prop"));
        assertTrue(results.hasError(this, null));
View Full Code Here

TOP

Related Classes of org.apache.bval.BeanValidationContext

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.