1 16 17 package org.apache.taglibs.standard.resources; 18 19 import java.text.MessageFormat ; 20 import java.util.MissingResourceException ; 21 import java.util.ResourceBundle ; 22 23 42 public class Resources { 43 44 47 48 private static final String RESOURCE_LOCATION 49 = "org.apache.taglibs.standard.resources.Resources"; 50 51 52 private static ResourceBundle rb = 53 ResourceBundle.getBundle(RESOURCE_LOCATION); 54 55 56 59 60 public static String getMessage(String name) 61 throws MissingResourceException { 62 return rb.getString(name); 63 } 64 65 66 public static String getMessage(String name, Object [] a) 67 throws MissingResourceException { 68 String res = rb.getString(name); 69 return MessageFormat.format(res, a); 70 } 71 72 73 public static String getMessage(String name, Object a1) 74 throws MissingResourceException { 75 return getMessage(name, new Object [] { a1 }); 76 } 77 78 79 public static String getMessage(String name, Object a1, Object a2) 80 throws MissingResourceException { 81 return getMessage(name, new Object [] { a1, a2 }); 82 } 83 84 85 public static String getMessage(String name, 86 Object a1, 87 Object a2, 88 Object a3) 89 throws MissingResourceException { 90 return getMessage(name, new Object [] { a1, a2, a3 }); 91 } 92 93 94 public static String getMessage(String name, 95 Object a1, 96 Object a2, 97 Object a3, 98 Object a4) 99 throws MissingResourceException { 100 return getMessage(name, new Object [] { a1, a2, a3, a4 }); 101 } 102 103 104 public static String getMessage(String name, 105 Object a1, 106 Object a2, 107 Object a3, 108 Object a4, 109 Object a5) 110 throws MissingResourceException { 111 return getMessage(name, new Object [] { a1, a2, a3, a4, a5 }); 112 } 113 114 115 public static String getMessage(String name, 116 Object a1, 117 Object a2, 118 Object a3, 119 Object a4, 120 Object a5, 121 Object a6) 122 throws MissingResourceException { 123 return getMessage(name, new Object [] { a1, a2, a3, a4, a5, a6 }); 124 } 125 126 } 127 | Popular Tags |