Package org.springframework.rules.constraint.property

Examples of org.springframework.rules.constraint.property.CompoundPropertyConstraint


   * validation of another.
   *
   * @see ConditionalPropertyConstraint
   */
  public PropertyConstraint ifTrue(PropertyConstraint ifConstraint, PropertyConstraint[] thenConstraints) {
    return new ConditionalPropertyConstraint(ifConstraint, new CompoundPropertyConstraint(new And(thenConstraints)));
  }
View Full Code Here


   * validation of another.
   *
   * @see ConditionalPropertyConstraint
   */
  public PropertyConstraint ifTrue(PropertyConstraint ifConstraint, PropertyConstraint[] thenConstraints, String type) {
    return new ConditionalPropertyConstraint(ifConstraint, new CompoundPropertyConstraint(new And(thenConstraints)), type);
  }
View Full Code Here

   * @see ConditionalPropertyConstraint
   */
  public PropertyConstraint ifTrue(PropertyConstraint ifConstraint, PropertyConstraint[] thenConstraints,
      PropertyConstraint[] elseConstraints) {
    return new ConditionalPropertyConstraint(ifConstraint,
        new CompoundPropertyConstraint(new And(thenConstraints)), new CompoundPropertyConstraint(new And(
            elseConstraints)));
  }
View Full Code Here

   * @see ConditionalPropertyConstraint
   */
  public PropertyConstraint ifTrue(PropertyConstraint ifConstraint, PropertyConstraint[] thenConstraints,
      PropertyConstraint[] elseConstraints, String type) {
    return new ConditionalPropertyConstraint(ifConstraint,
        new CompoundPropertyConstraint(new And(thenConstraints)), new CompoundPropertyConstraint(new And(
            elseConstraints)), type);
  }
View Full Code Here

     * @since 0.3.0
     */
    public PropertyConstraint inRangeProperties(String propertyName, String minPropertyName, String maxPropertyName, Comparator comparator) {
        Constraint min = gteProperty(propertyName, minPropertyName, comparator);
        Constraint max = lteProperty(propertyName, maxPropertyName, comparator);
        return new CompoundPropertyConstraint(new And(min, max));
    }
View Full Code Here

     * @return The range constraint constraint
     */
    public PropertyConstraint inRangeProperties(String propertyName, String minPropertyName, String maxPropertyName) {
        Constraint min = gteProperty(propertyName, minPropertyName);
        Constraint max = lteProperty(propertyName, maxPropertyName);
        return new CompoundPropertyConstraint(new And(min, max));
    }
View Full Code Here

    and.add(constraint);
    if (logger.isDebugEnabled()) {
      logger.debug("Putting constraint for property '" + constraint.getPropertyName() + "', constraint -> ["
          + constraint + "]");
    }
        PropertyConstraint compoundConstraint = new CompoundPropertyConstraint(and);
    propertiesConstraints.put(constraint.getPropertyName(), compoundConstraint);
        orderedConstraints.add( compoundConstraint );
  }
View Full Code Here

   * @param constraint
   *            the bean property expression
   * @return this, to support chaining.
   */
  public Rules add(PropertyConstraint constraint) {
    CompoundPropertyConstraint and = (CompoundPropertyConstraint)propertiesConstraints.get(constraint
        .getPropertyName());
    if (and == null) {
      putPropertyConstraint(constraint);
    }
    else {
      and.add(constraint);
    }
    return this;
  }
View Full Code Here

   * objects, as a bean property constraint.
   *
   * @param compoundPredicate
   */
  public void add(CompoundConstraint compoundPredicate) {
    add(new CompoundPropertyConstraint(compoundPredicate));
  }
View Full Code Here

  public void testCompoundRules() {
    Rules r = new Rules(TestBean.class);
    // test must be required, and have a length in range 3 to 25
    // or test must just equal confirmTest
    CompoundPropertyConstraint rules = new CompoundPropertyConstraint(constraints.or(constraints.all("test",
        new Constraint[] { constraints.required(), constraints.maxLength(25), constraints.minLength(3) }),
        constraints.eqProperty("test", "confirmTest")));
    r.add(rules);
    assertTrue(r.test(new TestBean()));
    TestBean b = new TestBean();
View Full Code Here

TOP

Related Classes of org.springframework.rules.constraint.property.CompoundPropertyConstraint

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.