1 18 package org.apache.beehive.netui.script.common.bundle; 19 20 import java.util.Locale ; 21 import java.util.Enumeration ; 22 23 import org.apache.struts.util.MessageResources; 24 import org.apache.beehive.netui.util.internal.InternalStringBuilder; 25 26 28 class StrutsBundleNode 29 extends BundleNode { 30 31 private Locale _locale; 32 private MessageResources _messageResource; 33 34 StrutsBundleNode(Locale locale, MessageResources messageResource) { 35 _locale = locale; 36 _messageResource = messageResource; 37 } 38 39 public boolean containsKey(String key) { 40 return _messageResource.getMessage(_locale, key) != null; 41 } 42 43 public String getString(String key) { 44 return _messageResource.getMessage(_locale, key); 45 } 46 47 public Enumeration getKeys() { 48 throw new UnsupportedOperationException ("The getKeys() method is not supported on the MessageResources type."); 49 } 50 51 public String toString() { 52 InternalStringBuilder sb = new InternalStringBuilder(); 53 sb.append("StrutsBundleNode "); 54 sb.append("messageResource: "); 55 sb.append(_messageResource); 56 sb.append(" "); 57 sb.append("locale: "); 58 sb.append(_locale); 59 return sb.toString(); 60 } 61 } 62 | Popular Tags |