1 7 8 package com.sun.enterprise.admin.mbeans.custom; 9 10 import java.util.*; 11 import java.text.MessageFormat ; 12 13 17 18 class Strings 19 { 20 Strings(String ... fqnPropsList) 21 { 22 for(String fqnProps : fqnPropsList) 23 addBundle(fqnProps); 24 } 25 26 28 void addBundle(String fqnProps) 29 { 30 try 32 { 33 bundles.add(ResourceBundle.getBundle(fqnProps)); 34 } 35 catch(Exception e) 36 { 37 } 39 } 40 41 43 String get(String indexString) 44 { 45 for(ResourceBundle bundle : bundles) 47 { 48 try 49 { 50 return bundle.getString(indexString); 51 } 52 catch (Exception e) 53 { 54 } 56 } 57 return indexString; 59 } 60 61 63 String get(String indexString, Object ... objects) 64 { 65 indexString = get(indexString); 66 67 try 68 { 69 MessageFormat mf = new MessageFormat (indexString); 70 return mf.format(objects); 71 } 72 catch(Exception e) 73 { 74 return indexString; 75 } 76 } 77 78 80 List<ResourceBundle> getBundles() 81 { 82 return bundles; 84 } 85 86 88 private List<ResourceBundle> bundles = new ArrayList<ResourceBundle>(); 89 } 90 | Popular Tags |