1 19 20 package org.netbeans.modules.j2ee.sun.validation.constraints; 21 22 import java.text.MessageFormat ; 23 import org.netbeans.modules.j2ee.sun.validation.util.BundleReader; 24 25 26 36 class ConstraintUtils { 37 38 39 40 41 ConstraintUtils() { 42 } 43 44 45 48 void print() { 49 String format = BundleReader.getValue("Name_Value_Pair_Format"); Object [] arguments = new Object []{"Constraint", this}; System.out.println(MessageFormat.format(format, arguments)); 52 } 53 54 55 65 String formatFailureMessage(String constraint, String value, 66 String name){ 67 String failureMessage = null; 68 if(!((constraint == null) || (constraint.length() == 0) || 69 (value == null) || (name == null) || (name.length() == 0))){ 70 71 String format = BundleReader.getValue("MSG_Failure"); Object [] arguments = new Object []{constraint, value, name}; 73 74 failureMessage = MessageFormat.format(format, arguments); 75 } 76 return failureMessage; 77 } 78 79 80 89 String formatFailureMessage(String constraint, String name){ 90 String failureMessage = null; 91 if(!((constraint == null) || (constraint.length() == 0) || 92 (name == null) || (name.length() == 0))){ 93 94 String format = BundleReader.getValue("MSG_Failure_1"); Object [] arguments = new Object []{constraint, name}; 96 97 failureMessage = MessageFormat.format(format, arguments); 98 } 99 return failureMessage; 100 } 101 } 102 | Popular Tags |