KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > testelement > property > StringProperty


1 // $Header: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/testelement/property/StringProperty.java,v 1.10 2004/02/13 02:40:53 sebb Exp $
2
/*
3  * Copyright 2003-2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * 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: 1.10 $
25  */

26 public class StringProperty extends AbstractProperty
27 {
28     String JavaDoc value;
29     String JavaDoc savedValue;
30
31     public StringProperty(String JavaDoc name, String JavaDoc value)
32     {
33         super(name);
34         this.value = value;
35     }
36
37     public StringProperty()
38     {
39         super();
40     }
41
42     /**
43      * @see JMeterProperty#setRunningVersion(boolean)
44      */

45     public void setRunningVersion(boolean runningVersion)
46     {
47         super.setRunningVersion(runningVersion);
48         if(runningVersion)
49         {
50             savedValue = value;
51         }
52         else
53         {
54             savedValue = null;
55         }
56     }
57
58     public void setObjectValue(Object JavaDoc v)
59     {
60         value = v.toString();
61     }
62
63     /**
64      * @see JMeterProperty#getStringValue()
65      */

66     public String JavaDoc getStringValue()
67     {
68         return value;
69     }
70
71     /**
72      * @see JMeterProperty#getObjectValue()
73      */

74     public Object JavaDoc getObjectValue()
75     {
76         return value;
77     }
78
79     /**
80      * @see Object#clone()
81      */

82     public Object JavaDoc clone()
83     {
84         StringProperty prop = (StringProperty) super.clone();
85         prop.value = value;
86         return prop;
87     }
88
89     /**
90      * Sets the value.
91      * @param value The value to set
92      */

93     public void setValue(String JavaDoc value)
94     {
95         this.value = value;
96     }
97
98     /* (non-Javadoc)
99      * @see JMeterProperty#recoverRunningVersion(TestElement)
100      */

101     public void recoverRunningVersion(TestElement owner)
102     {
103         if (savedValue != null)
104         {
105             value = savedValue;
106         }
107     }
108 }
109
Popular Tags