1 7 8 package java.beans; 9 10 30 public class Expression extends Statement { 31 32 private static Object unbound = new Object (); 33 34 private Object value = unbound; 35 36 46 public Expression(Object target, String methodName, Object [] arguments) { 47 super(target, methodName, arguments); 48 } 49 50 64 public Expression(Object value, Object target, String methodName, Object [] arguments) { 65 this(target, methodName, arguments); 66 setValue(value); 67 } 68 69 96 public Object getValue() throws Exception { 97 if (value == unbound) { 98 setValue(invoke()); 99 } 100 return value; 101 } 102 103 113 public void setValue(Object value) { 114 this.value = value; 115 } 116 117 String instanceName(Object instance) { 118 return instance == unbound ? "<unbound>" : super.instanceName(instance); 119 } 120 121 124 public String toString() { 125 return instanceName(value) + "=" + super.toString(); 126 } 127 } 128 | Popular Tags |