1 17 package org.apache.el.util; 18 19 import java.text.MessageFormat ; 20 import java.util.ResourceBundle ; 21 22 26 public final class MessageFactory { 27 28 protected final static ResourceBundle bundle = ResourceBundle 29 .getBundle("org.apache.el.Messages"); 30 33 public MessageFactory() { 34 super(); 35 } 36 37 public static String get(final String key) { 38 return bundle.getString(key); 39 } 40 41 public static String get(final String key, final Object obj0) { 42 return getArray(key, new Object [] { obj0 }); 43 } 44 45 public static String get(final String key, final Object obj0, 46 final Object obj1) { 47 return getArray(key, new Object [] { obj0, obj1 }); 48 } 49 50 public static String get(final String key, final Object obj0, 51 final Object obj1, final Object obj2) { 52 return getArray(key, new Object [] { obj0, obj1, obj2 }); 53 } 54 55 public static String get(final String key, final Object obj0, 56 final Object obj1, final Object obj2, final Object obj3) { 57 return getArray(key, new Object [] { obj0, obj1, obj2, obj3 }); 58 } 59 60 public static String get(final String key, final Object obj0, 61 final Object obj1, final Object obj2, final Object obj3, 62 final Object obj4) { 63 return getArray(key, new Object [] { obj0, obj1, obj2, obj3, obj4 }); 64 } 65 66 public static String getArray(final String key, final Object [] objA) { 67 return MessageFormat.format(bundle.getString(key), objA); 68 } 69 70 } 71 | Popular Tags |