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 NumberConstraint extends ConstraintUtils 43 implements Constraint { 44 45 46 public NumberConstraint() { 47 } 48 49 50 63 public Collection match(String value, String name) { 64 ArrayList failed_constrained_list = new ArrayList (); 65 if(null != value){ 66 try { 67 new Double (value); 68 return failed_constrained_list; 69 } catch(NumberFormatException e) { 70 String failureMessage = formatFailureMessage(toString(), value, 71 name); 72 73 failed_constrained_list.add(new ConstraintFailure(toString(), 74 value, name, failureMessage, BundleReader.getValue( 75 "MSG_NumberConstraint_Failure"))); } 77 } 78 return failed_constrained_list; 79 } 80 } 81 | Popular Tags |