1 package org.sapia.validator.rules; 2 3 import org.sapia.validator.BeanRule; 4 5 16 public class MaxLen extends BeanRule{ 17 18 private int _len; 19 20 23 public MaxLen() { 24 throwExceptionOnNull(true); 25 } 26 27 32 public void setLen(int len){ 33 _len = len; 34 } 35 36 39 protected boolean doValidate(Object toValidate) { 40 return ((String )toValidate).length() <= _len; 41 } 42 43 44 } 45 | Popular Tags |