1 18 19 package org.apache.jmeter.testelement.property; 20 21 import org.apache.jmeter.testelement.TestElement; 22 23 26 public class TestElementProperty extends MultiProperty 27 { 28 TestElement value; 29 TestElement savedValue = null; 30 31 public TestElementProperty(String name, TestElement value) 32 { 33 super(name); 34 this.value = value; 35 } 36 37 public TestElementProperty() 38 { 39 super(); 40 } 41 42 48 public boolean equals(Object o) 49 { 50 if (o instanceof TestElementProperty) 51 { 52 if (this == o) return true; 53 if (value != null) 54 { 55 return value.equals(((JMeterProperty) o).getObjectValue()); 56 } 57 } 58 return false; 59 } 60 public int hashCode() 61 { 62 return value == null ? 0 : value.hashCode(); 63 } 64 65 68 public String getStringValue() 69 { 70 return value.toString(); 71 } 72 73 public void setObjectValue(Object v) 74 { 75 if (v instanceof TestElement) 76 { 77 value = (TestElement) v; 78 } 79 } 80 81 84 public Object getObjectValue() 85 { 86 return value; 87 } 88 89 public TestElement getElement() 90 { 91 return value; 92 } 93 94 public void setElement(TestElement el) 95 { 96 value = el; 97 } 98 99 102 public Object clone() 103 { 104 TestElementProperty prop = (TestElementProperty) super.clone(); 105 prop.value = (TestElement) value.clone(); 106 return prop; 107 } 108 109 112 public void mergeIn(JMeterProperty prop) 113 { 114 if (isEqualType(prop)) 115 { 116 value.addTestElement((TestElement) prop.getObjectValue()); 117 } 118 } 119 120 123 public void recoverRunningVersion(TestElement owner) 124 { 125 if (savedValue != null) 126 { 127 value = savedValue; 128 } 129 value.recoverRunningVersion(); 130 } 131 132 135 public void setRunningVersion(boolean runningVersion) 136 { 137 super.setRunningVersion(runningVersion); 138 value.setRunningVersion(runningVersion); 139 if(runningVersion) 140 { 141 savedValue = value; 142 } 143 else 144 { 145 savedValue = null; 146 } 147 } 148 149 152 public void addProperty(JMeterProperty prop) 153 { 154 value.setProperty(prop); 155 } 156 157 160 public void clear() 161 { 162 value.clear(); 163 164 } 165 166 169 public PropertyIterator iterator() 170 { 171 return value.propertyIterator(); 172 } 173 } 174 | Popular Tags |