1 package org.sapia.magnet.domain.system; 2 3 import org.sapia.magnet.render.AbstractRenderable; 6 import org.sapia.magnet.render.MagnetContext; 7 import org.sapia.magnet.render.RenderingException; 8 9 10 20 public class Variable extends AbstractRenderable { 21 22 26 27 private String _theName; 28 29 30 private String _theValue; 31 32 36 39 public Variable() { 40 } 41 42 46 51 public String getName() { 52 return _theName; 53 } 54 55 60 public String getValue() { 61 return _theValue; 62 } 63 64 68 73 public void setName(String aName) { 74 _theName = aName; 75 } 76 77 82 public void setValue(String aValue) { 83 _theValue = aValue; 84 } 85 86 90 96 public void render(MagnetContext aContext) throws RenderingException { 97 try { 99 _theName = resolveValue(aContext, _theName); 100 _theValue = resolveValue(aContext, _theValue); 101 } catch (RenderingException re) { 102 StringBuffer aBuffer = new StringBuffer (); 103 aBuffer.append("Unable to resolve an attribute of the variable '"). 104 append(_theName).append("'"); 105 106 throw new RenderingException(aBuffer.toString(), re); 107 } 108 } 109 110 115 public String toString() { 116 StringBuffer aBuffer = new StringBuffer (super.toString()); 117 aBuffer.append("[name=").append(_theName). 118 append(" value=").append(_theValue). 119 append("]"); 120 121 return aBuffer.toString(); 122 } 123 } 124 | Popular Tags |