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 BooleanProperty extends AbstractProperty {
27: private boolean value;
28:
29: private transient boolean savedValue;
30:
31: public BooleanProperty(String name, boolean v) {
32: super (name);
33: value = v;
34: }
35:
36: public BooleanProperty() {
37: super ();
38: }
39:
40: public void setObjectValue(Object v) {
41: if (v instanceof Boolean) {
42: value = ((Boolean) v).booleanValue();
43: } else {
44: value = Boolean.valueOf(v.toString()).booleanValue();
45: }
46: }
47:
48: /**
49: * @see JMeterProperty#getStringValue()
50: */
51: public String getStringValue() {
52: return Boolean.toString(value);
53: }
54:
55: /**
56: * @see JMeterProperty#getObjectValue()
57: */
58: public Object getObjectValue() {
59: return Boolean.valueOf(value);
60: }
61:
62: public Object clone() {
63: BooleanProperty prop = (BooleanProperty) super .clone();
64: prop.value = value;
65: return prop;
66: }
67:
68: /**
69: * @see JMeterProperty#getBooleanValue()
70: */
71: public boolean getBooleanValue() {
72: return value;
73: }
74:
75: /*
76: * (non-Javadoc)
77: *
78: * @see org.apache.jmeter.testelement.property.JMeterProperty#setRunningVersion(boolean)
79: */
80: public void setRunningVersion(boolean runningVersion) {
81: savedValue = value;
82: super .setRunningVersion(runningVersion);
83: }
84:
85: /*
86: * (non-Javadoc)
87: *
88: * @see org.apache.jmeter.testelement.property.JMeterProperty#recoverRunningVersion(org.apache.jmeter.testelement.TestElement)
89: */
90: public void recoverRunningVersion(TestElement owner) {
91: value = savedValue;
92: }
93:
94: }
|