1 55 56 package org.jboss.axis.i18n; 57 58 import java.util.Locale ; 59 import java.util.MissingResourceException ; 60 import java.util.ResourceBundle ; 61 62 63 79 public class Messages 80 { 81 private static final Class thisClass = Messages.class; 82 83 private static final String projectName = MessagesConstants.projectName; 84 85 private static final String resourceName = MessagesConstants.resourceName; 86 private static final Locale locale = MessagesConstants.locale; 87 88 private static final String packageName = getPackage(thisClass.getName()); 89 private static final ClassLoader classLoader = thisClass.getClassLoader(); 90 91 private static final ResourceBundle parent = 92 (MessagesConstants.rootPackageName == packageName) 93 ? null 94 : MessagesConstants.rootBundle; 95 96 97 100 101 private static final MessageBundle messageBundle = 102 new MessageBundle(projectName, packageName, resourceName, 103 locale, classLoader, parent); 104 105 113 public static String getMessage(String key) 114 throws MissingResourceException 115 { 116 return messageBundle.getMessage(key); 117 } 118 119 128 public static String getMessage(String key, String arg0) 129 throws MissingResourceException 130 { 131 return messageBundle.getMessage(key, arg0); 132 } 133 134 144 public static String getMessage(String key, String arg0, String arg1) 145 throws MissingResourceException 146 { 147 return messageBundle.getMessage(key, arg0, arg1); 148 } 149 150 161 public static String getMessage(String key, String arg0, String arg1, String arg2) 162 throws MissingResourceException 163 { 164 return messageBundle.getMessage(key, arg0, arg1, arg2); 165 } 166 167 179 public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3) 180 throws MissingResourceException 181 { 182 return messageBundle.getMessage(key, arg0, arg1, arg2, arg3); 183 } 184 185 198 public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3, String arg4) 199 throws MissingResourceException 200 { 201 return messageBundle.getMessage(key, arg0, arg1, arg2, arg3, arg4); 202 } 203 204 213 public static String getMessage(String key, String [] args) 214 throws MissingResourceException 215 { 216 return messageBundle.getMessage(key, args); 217 } 218 219 public static ResourceBundle getResourceBundle() 220 { 221 return messageBundle.getResourceBundle(); 222 } 223 224 public static MessageBundle getMessageBundle() 225 { 226 return messageBundle; 227 } 228 229 private static final String getPackage(String name) 230 { 231 return name.substring(0, name.lastIndexOf('.')).intern(); 232 } 233 } 234 | Popular Tags |