1 19 20 package org.netbeans.modules.j2ee.sun.validation.constraints; 21 22 import java.util.ArrayList ; 23 import java.util.Collection ; 24 25 import org.netbeans.modules.j2ee.sun.validation.constraints.ConstraintFailure; 26 import org.netbeans.modules.j2ee.sun.validation.util.BundleReader; 27 28 42 public class NonBlankConstraint extends ConstraintUtils 43 implements Constraint { 44 45 46 public NonBlankConstraint() { 47 } 48 49 50 63 public Collection match(String value, String name) { 64 Collection failed_constrained_list = new ArrayList (); 65 if((value != null) && (value.length() != 0)) { 66 value = value.trim(); 67 if(value.length() == 0){ 68 String failureMessage = formatFailureMessage(toString(), name); 69 failed_constrained_list.add(new ConstraintFailure(toString(), 70 value, name, failureMessage, BundleReader.getValue( 71 "MSG_NonBlankConstraint_Failure"))); } 73 } 74 return failed_constrained_list; 75 } 76 } 77 | Popular Tags |