List of utility methods to do Resource Message
String | getMessage(String pkg, String name, Object[] args) Locate the given message and merge it with the given arguments using the MessageFormat class. return getMessage(pkg, name, args, Locale.getDefault());
|
String | getMessage(String value, Object... args) get Message try { MessageFormat format = new MessageFormat(escape(value)); value = format.format(args); return value; } catch (MissingResourceException e) { return "???" + value + "???"; |
String | getMessageCreateTime() get Message Create Time Date date = new Date(); DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String nowTime = df.format(date); return nowTime; |
MessageFormat | getMessageFormat(final String bundleKey, final String messageKey, final Locale locale) get Message Format assert bundleKey != null; assert messageKey != null; assert locale != null; Map<String, Map<Locale, MessageFormat>> messageKey2Locale2MessageFormat; Map<Locale, MessageFormat> locale2MessageFormat; MessageFormat messageFormat; messageKey2Locale2MessageFormat = bundleKey2MessageKey2Locale2MessageFormat.get(bundleKey); if (messageKey2Locale2MessageFormat == null) { ... |
String | getMessageFormattedTime(Date date) get Message Formatted Time return messageTimeFormatter.format(date);
|
String | getMessageNoKey(String messageName) This method does the same thing as getMessage() but does not prepend the message key to the message. try { return findMessage(messageName); } catch (Exception e) { return messageName; |
T | getMessages(final Class This method returns a proxy implementing the specified interface. T messages = (T) fMessages.get(cls); if (messages == null) { messages = newMessages(cls); fMessages.put(cls, messages); return messages; |
String | getMessageString(String bundleName, String key, Object[] params, Locale locale) get Message String String text; ResourceBundle bundle = ResourceBundle.getBundle(bundleName, locale, getCurrentClassLoader(params)); try { text = bundle.getString(key); } catch (MissingResourceException e) { text = key; if (params != null) { ... |
String | getMessageString(String key, Locale locale) Gets messages ResourceBundle MESSAGE_RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME, locale);
return MESSAGE_RESOURCE_BUNDLE.getString(key);
|
String | getMessageString(String key, Locale locale) Gets messages return getMessageString(key, locale, new Object[] {}); |