Package org.springframework.rules.constraint.property

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


     * @param propertyName the bean property name
     * @param valueConstraint the value constraint
     * @return The bean property expression that tests the constraint
     */
    public PropertyConstraint value(String propertyName, Constraint valueConstraint) {
        return new PropertyValueConstraint(propertyName, valueConstraint);
    }
View Full Code Here


   *            The property name.
   * @param valueConstraint
   *            The value constraint.
   */
  public void add(String propertyName, Constraint valueConstraint) {
    add(new PropertyValueConstraint(propertyName, valueConstraint));
  }
View Full Code Here

   *            The property name.
   * @param valueConstraint
   *            The value constraint.
   */
  public void add(String propertyName, Constraint[] valueConstraints) {
    add(new PropertyValueConstraint(propertyName, all(valueConstraints)));
  }
View Full Code Here

    public PropertyConstraint getPropertyConstraint(String propertyName) {
      if (StringUtils.hasText(regExp))
      {
        if ((propertyName == null) || ("value".equals(propertyName))) {
          return new PropertyValueConstraint("value", new RegexpConstraint(regExp, "regExpViolated"));
        }
      }
      return null;
    }
View Full Code Here

      this.value = value;
    }

    public PropertyConstraint getPropertyConstraint(String propertyName) {
      if (isRangeConstraint()) {
        return new PropertyValueConstraint("value", new StringLengthConstraint(minLength, maxLength,
            "rangeConstraint"));
      }

      return new PropertyValueConstraint("value", new StringLengthConstraint(relationalOperator, length));
    }
View Full Code Here

  public void testBeanPropertyValueConstraint() {
    And p = constraints.conjunction();
    p.add(constraints.required());
    p.add(constraints.maxLength(9));
    PropertyConstraint e = new PropertyValueConstraint("test", p);
    assertTrue(e.test(new TestBean()));

    p = constraints.conjunction();
    e = new PropertyValueConstraint("test", p);
    p.add(constraints.required());
    p.add(constraints.maxLength(3));
    assertFalse(e.test(new TestBean()));
  }
View Full Code Here

TOP

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

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.