1 16 17 package org.apache.axis.i18n; 18 19 import java.util.Locale ; 20 import java.util.MissingResourceException ; 21 import java.util.ResourceBundle ; 22 23 24 41 public class Messages { 42 private static final Class thisClass = Messages.class; 43 44 private static final String projectName = MessagesConstants.projectName; 45 46 private static final String resourceName = MessagesConstants.resourceName; 47 private static final Locale locale = MessagesConstants.locale; 48 49 private static final String packageName = getPackage(thisClass.getName()); 50 private static final ClassLoader classLoader = thisClass.getClassLoader(); 51 52 private static final ResourceBundle parent = 53 (MessagesConstants.rootPackageName == packageName) 54 ? null 55 : MessagesConstants.rootBundle; 56 57 58 59 60 private static final MessageBundle messageBundle = 61 new MessageBundle(projectName, packageName, resourceName, 62 locale, classLoader, parent); 63 64 69 public static String getMessage(String key) 70 throws MissingResourceException 71 { 72 return messageBundle.getMessage(key); 73 } 74 75 81 public static String getMessage(String key, String arg0) 82 throws MissingResourceException 83 { 84 return messageBundle.getMessage(key, arg0); 85 } 86 87 94 public static String getMessage(String key, String arg0, String arg1) 95 throws MissingResourceException 96 { 97 return messageBundle.getMessage(key, arg0, arg1); 98 } 99 100 108 public static String getMessage(String key, String arg0, String arg1, String arg2) 109 throws MissingResourceException 110 { 111 return messageBundle.getMessage(key, arg0, arg1, arg2); 112 } 113 114 123 public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3) 124 throws MissingResourceException 125 { 126 return messageBundle.getMessage(key, arg0, arg1, arg2, arg3); 127 } 128 129 139 public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3, String arg4) 140 throws MissingResourceException 141 { 142 return messageBundle.getMessage(key, arg0, arg1, arg2, arg3, arg4); 143 } 144 145 151 public static String getMessage(String key, String [] args) 152 throws MissingResourceException 153 { 154 return messageBundle.getMessage(key, args); 155 } 156 157 public static ResourceBundle getResourceBundle() { 158 return messageBundle.getResourceBundle(); 159 } 160 161 public static MessageBundle getMessageBundle() { 162 return messageBundle; 163 } 164 165 private static final String getPackage(String name) { 166 return name.substring(0, name.lastIndexOf('.')).intern(); 167 } 168 } 169 | Popular Tags |