1 15 package org.apache.tapestry.binding; 16 17 import org.apache.hivemind.Location; 18 import org.apache.hivemind.util.Defense; 19 import org.apache.tapestry.IComponent; 20 import org.apache.tapestry.coerce.ValueConverter; 21 22 31 32 public class MessageBinding extends AbstractBinding 33 { 34 private final IComponent _component; 35 36 private final String _key; 37 38 protected MessageBinding(String description, ValueConverter valueConverter, Location location, 39 IComponent component, String key) 40 { 41 super(description, valueConverter, location); 42 43 Defense.notNull(component, "component"); 44 Defense.notNull(key, "key"); 45 46 _component = component; 47 _key = key; 48 } 49 50 public Object getComponent() 51 { 52 return _component; 53 } 54 55 public String getKey() 56 { 57 return _key; 58 } 59 60 63 64 public Object getObject() 65 { 66 return _component.getMessages().getMessage(_key); 67 } 68 69 public String toString() 70 { 71 StringBuffer buffer = new StringBuffer ("StringBinding"); 72 buffer.append('['); 73 buffer.append(_component.getExtendedId()); 74 buffer.append(' '); 75 buffer.append(_key); 76 buffer.append(']'); 77 78 return buffer.toString(); 79 } 80 } | Popular Tags |