01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18:
19: package org.apache.jmeter.testelement.property;
20:
21: import org.apache.jmeter.testelement.TestElement;
22:
23: /**
24: * @version $Revision: 571988 $
25: */
26: public class StringProperty extends AbstractProperty {
27: private String value;
28:
29: private transient String savedValue;
30:
31: public StringProperty(String name, String value) {
32: super (name);
33: this .value = value;
34: }
35:
36: public StringProperty() {
37: super ();
38: }
39:
40: /**
41: * @see JMeterProperty#setRunningVersion(boolean)
42: */
43: public void setRunningVersion(boolean runningVersion) {
44: super .setRunningVersion(runningVersion);
45: if (runningVersion) {
46: savedValue = value;
47: } else {
48: savedValue = null;
49: }
50: }
51:
52: public void setObjectValue(Object v) {
53: value = v.toString();
54: }
55:
56: /**
57: * @see JMeterProperty#getStringValue()
58: */
59: public String getStringValue() {
60: return value;
61: }
62:
63: /**
64: * @see JMeterProperty#getObjectValue()
65: */
66: public Object getObjectValue() {
67: return value;
68: }
69:
70: public Object clone() {
71: StringProperty prop = (StringProperty) super .clone();
72: prop.value = value;
73: return prop;
74: }
75:
76: /**
77: * Sets the value.
78: *
79: * @param value
80: * The value to set
81: */
82: public void setValue(String value) {
83: this .value = value;
84: }
85:
86: /*
87: * (non-Javadoc)
88: *
89: * @see JMeterProperty#recoverRunningVersion(TestElement)
90: */
91: public void recoverRunningVersion(TestElement owner) {
92: if (savedValue != null) {
93: value = savedValue;
94: }
95: }
96: }
|