KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > config > Argument


1 // $Header: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/config/Argument.java,v 1.8.2.1 2004/10/17 20:32:37 sebb Exp $
2
/*
3  * Copyright 2001-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.config;
20
21 import java.io.Serializable JavaDoc;
22
23 import org.apache.jmeter.testelement.AbstractTestElement;
24 import org.apache.jmeter.testelement.property.StringProperty;
25
26 //Mark Walsh, 2002-08-03, add metadata attribute
27
// add constructor Argument(String name, Object value, Object metadata)
28
// add MetaData get and set methods
29

30 /**
31  * Class representing an argument. Each argument consists of a name/value pair,
32  * as well as (optional) metadata.
33  *
34  * @author Michael Stover
35  * @author Mark Walsh
36  * @version $Revision: 1.8.2.1 $
37  */

38 public class Argument extends AbstractTestElement implements Serializable JavaDoc
39 {
40     /** Name used to store the argument's name. */
41     public static final String JavaDoc ARG_NAME = "Argument.name";
42
43     /** Name used to store the argument's value. */
44     public static final String JavaDoc VALUE = "Argument.value";
45
46     /** Name used to store the argument's metadata. */
47     public static final String JavaDoc METADATA = "Argument.metadata";
48
49     /**
50      * Create a new Argument without a name, value, or metadata.
51      */

52     public Argument()
53     {
54     }
55
56     /**
57      * Create a new Argument with the specified name and value, and no
58      * metadata.
59      *
60      * @param name the argument name
61      * @param value the argument value
62      */

63     public Argument(String JavaDoc name, String JavaDoc value)
64     {
65         setProperty(new StringProperty(ARG_NAME, name));
66         setProperty(new StringProperty(VALUE, value));
67     }
68
69     /**
70      * Create a new Argument with the specified name, value, and metadata.
71      *
72      * @param name the argument name
73      * @param value the argument value
74      * @param metadata the argument metadata
75      */

76     public Argument(String JavaDoc name, String JavaDoc value, String JavaDoc metadata)
77     {
78         setProperty(new StringProperty(ARG_NAME, name));
79         setProperty(new StringProperty(VALUE, value));
80         setProperty(new StringProperty(METADATA, metadata));
81     }
82
83     /**
84      * Set the name of the Argument.
85      *
86      * @param newName the new name
87      */

88     public void setName(String JavaDoc newName)
89     {
90         setProperty(new StringProperty(ARG_NAME, newName));
91     }
92
93     /**
94      * Get the name of the Argument.
95      *
96      * @return the attribute's name
97      */

98     public String JavaDoc getName()
99     {
100         return getPropertyAsString(ARG_NAME);
101     }
102
103     /**
104      * Sets the value of the Argument.
105      *
106      * @param newValue the new value
107      */

108     public void setValue(String JavaDoc newValue)
109     {
110         setProperty(new StringProperty(VALUE, newValue));
111     }
112
113     /**
114      * Gets the value of the Argument object.
115      *
116      * @return the attribute's value
117      */

118     public String JavaDoc getValue()
119     {
120         return getPropertyAsString(VALUE);
121     }
122
123     /**
124      * Sets the Meta Data attribute of the Argument.
125      *
126      * @param newMetaData the new metadata
127      */

128     public void setMetaData(String JavaDoc newMetaData)
129     {
130         setProperty(new StringProperty(METADATA, newMetaData));
131     }
132
133     /**
134      * Gets the Meta Data attribute of the Argument.
135      *
136      * @return the MetaData value
137      */

138     public String JavaDoc getMetaData()
139     {
140         return getPropertyAsString(METADATA);
141     }
142     
143     public String JavaDoc toString()
144     {
145         return getName()+getMetaData()+getValue();
146     }
147 }
148
Popular Tags