1 19 20 package org.netbeans.modules.j2ee.sun.validation.constraints; 21 22 import java.text.MessageFormat ; 23 import java.util.ArrayList ; 24 import java.util.Collection ; 25 26 import org.netbeans.modules.j2ee.sun.validation.Constants; 27 import org.netbeans.modules.j2ee.sun.validation.constraints.ConstraintFailure; 28 import org.netbeans.modules.j2ee.sun.validation.util.BundleReader; 29 30 31 45 public class BooleanConstraint extends ConstraintUtils 46 implements Constraint { 47 48 49 public BooleanConstraint() { 50 } 51 52 53 67 public java.util.Collection match(String value, String name) { 68 Collection failed_constrained_list = new ArrayList (); 69 if((value != null) && (value.length() != 0)) { 70 if (!( (value.equalsIgnoreCase("true")) || (value.equalsIgnoreCase("false")))){ String failureMessage = formatFailureMessage(toString(), value, 73 name); 74 75 String format = BundleReader.getValue( 76 "MSG_BooleanConstraint_Failure"); Object [] arguments = new Object []{"True", "False"}; 79 String genericFailureMessage = 80 MessageFormat.format(format, arguments); 81 82 failed_constrained_list.add(new ConstraintFailure(toString(), 83 value, name, failureMessage, genericFailureMessage)); 84 } 85 } 86 return failed_constrained_list; 87 } 88 } 89 | Popular Tags |