1 4 package com.tc.admin.dso; 5 6 import com.tc.admin.AdminClient; 7 import com.tc.admin.ConnectionContext; 8 import com.tc.objectserver.mgmt.MapEntryFacade; 9 10 public class DSOMapEntryField extends DSOObject { 11 private String m_name; 12 private MapEntryFacade m_facade; 13 private DSOObject m_key; 14 private DSOObject m_value; 15 private String m_label; 16 17 private static final String TYPE = 18 AdminClient.getContext().getMessage("map.entry"); 19 20 public DSOMapEntryField( 21 ConnectionContext cc, 22 String name, 23 MapEntryFacade facade, 24 DSOObject parent) 25 { 26 super(cc, parent); 27 28 m_name = name; 29 m_facade = facade; 30 m_label = m_name + " (" + TYPE + ")"; 31 } 32 33 public Object getFacade() { 34 return m_facade; 35 } 36 37 public String getName() { 38 return m_name; 39 } 40 41 public DSOObject getKey() { 42 if(m_key == null) { 43 m_key = getElement("key", m_facade.getKey()); 44 } 45 46 return m_key; 47 } 48 49 public DSOObject getValue() { 50 if(m_value == null) { 51 m_value = getElement("value", m_facade.getValue()); 52 } 53 54 return m_value; 55 } 56 57 private DSOObject getElement(String field, Object value) { 58 try { 59 return createField(field, value); 60 } 61 catch(Throwable t) { 62 t.printStackTrace(); 63 } 64 65 return null; 66 } 67 68 public String toString() { 69 return m_label; 70 } 71 72 public void accept(DSOObjectVisitor visitor) { 73 visitor.visitDSOMapEntryField(this); 74 } 75 } 76 | Popular Tags |