1 23 24 28 29 package com.sun.enterprise.tools.common.validation.constraints; 30 31 import java.util.ArrayList ; 32 import java.util.Collection ; 33 34 import com.sun.enterprise.tools.common.validation.constraints.ConstraintFailure; 35 import com.sun.enterprise.tools.common.validation.util.BundleReader; 36 37 51 public class NumberConstraint extends ConstraintUtils 52 implements Constraint { 53 54 55 public NumberConstraint() { 56 } 57 58 59 72 public Collection match(String value, String name) { 73 ArrayList failed_constrained_list = new ArrayList (); 74 if(null != value){ 75 try { 76 new Double (value); 77 return failed_constrained_list; 78 } catch(NumberFormatException e) { 79 String failureMessage = formatFailureMessage(toString(), value, 80 name); 81 82 failed_constrained_list.add(new ConstraintFailure(toString(), 83 value, name, failureMessage, BundleReader.getValue( 84 "MSG_NumberConstraint_Failure"))); } 86 } 87 return failed_constrained_list; 88 } 89 } 90 | Popular Tags |