1 23 24 28 29 package com.sun.enterprise.tools.common.validation.constraints; 30 31 import java.text.MessageFormat ; 32 import com.sun.enterprise.tools.common.validation.util.BundleReader; 33 34 35 45 class ConstraintUtils { 46 47 48 49 50 ConstraintUtils() { 51 } 52 53 54 57 void print() { 58 String format = BundleReader.getValue("Name_Value_Pair_Format"); Object [] arguments = new Object []{"Constraint", this}; System.out.println(MessageFormat.format(format, arguments)); 61 } 62 63 64 74 String formatFailureMessage(String constraint, String value, 75 String name){ 76 String failureMessage = null; 77 if(!((constraint == null) || (constraint.length() == 0) || 78 (value == null) || (name == null) || (name.length() == 0))){ 79 80 String format = BundleReader.getValue("MSG_Failure"); Object [] arguments = new Object []{constraint, value, name}; 82 83 failureMessage = MessageFormat.format(format, arguments); 84 } 85 return failureMessage; 86 } 87 88 89 98 String formatFailureMessage(String constraint, String name){ 99 String failureMessage = null; 100 if(!((constraint == null) || (constraint.length() == 0) || 101 (name == null) || (name.length() == 0))){ 102 103 String format = BundleReader.getValue("MSG_Failure_1"); Object [] arguments = new Object []{constraint, name}; 105 106 failureMessage = MessageFormat.format(format, arguments); 107 } 108 return failureMessage; 109 } 110 } 111 | Popular Tags |