public static void validateAttribute(Attr attr,String validatorClass,String rule) throws UMSException, DataConstraintException {
  if (attr != null) {
    String[] values=attr.getStringValues();
    for (int i=0; i < values.length; i++) {
      String aValue=values[i];
      if ((aValue != null) && (!aValue.equalsIgnoreCase("")) && (validatorClass != null)) {
        IValidator validator=null;
        try {
          Class theClass=Class.forName(validatorClass);
          validator=(IValidator)theClass.newInstance();
        }
 catch (        Exception e) {
          throw new UMSException(i18n.getString(IUMSConstants.INSTANCE_FAILED),e);
        }
        if (!validator.validate(aValue,rule)) {
          String msg=i18n.getString(IUMSConstants.DATA_CONSTRAINT);
          throw new DataConstraintException(msg + ": " + "{ type="+ attr.getName()+ ", value="+ aValue+ " }");
        }
      }
    }
  }
}

public static void validateAttribute ( Attr attr , String validatorClass , String rule ) throws UMSException , DataConstraintException { if ( attr != null ) { String [ ] values = attr . getStringValues ( ) ; for ( int i = 0 ; i < values . length ; i ++ ) { String aValue = values [ i ] ; if ( ( aValue != null ) && ( ! aValue . equalsIgnoreCase ( "" ) ) && ( validatorClass != null ) ) { IValidator validator = null ; try { Class theClass = Class . forName ( validatorClass ) ; validator = ( IValidator ) theClass . newInstance ( ) ; } catch ( Exception e ) { throw new UMSException ( i18n . getString ( IUMSConstants . INSTANCE_FAILED ) , e ) ; } if ( ! validator . validate ( aValue , rule ) ) { String msg = i18n . getString ( IUMSConstants . DATA_CONSTRAINT ) ; throw new DataConstraintException ( msg + ": " + "{ type=" + attr . getName ( ) + ", value=" + aValue + " }" ) ; } } } } }
determines whether a specific attribute is valid . called by validateattribute ( attr , class ) . this method calls the validation method for this attribute .
