001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
013: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
014: * License for the specific language governing permissions and limitations
015: * under the License.
016: *
017: */
018:
019: /*
020: * Created on Sep 16, 2004
021: */
022: package org.apache.jmeter.testelement.property;
023:
024: import org.apache.jmeter.testelement.TestElement;
025:
026: /**
027: * @author mstover
028: *
029: * To change the template for this generated type comment go to Window -
030: * Preferences - Java - Code Generation - Code and Comments
031: */
032: public class ObjectProperty extends AbstractProperty {
033: static final long serialVersionUID = 1;
034:
035: Object value;
036:
037: Object savedValue;
038:
039: /*
040: * (non-Javadoc)
041: *
042: * @see org.apache.jmeter.testelement.property.JMeterProperty#recoverRunningVersion(org.apache.jmeter.testelement.TestElement)
043: */
044: public void recoverRunningVersion(TestElement owner) {
045: if (savedValue != null) {
046: value = savedValue;
047: }
048: }
049:
050: public void setRunningVersion(boolean runningVersion) {
051: super .setRunningVersion(runningVersion);
052: if (runningVersion) {
053: savedValue = value;
054: } else {
055: savedValue = null;
056: }
057: }
058:
059: /*
060: * (non-Javadoc)
061: *
062: * @see java.lang.Object#clone()
063: */
064: public Object clone() {
065: ObjectProperty p = (ObjectProperty) super .clone();
066: p.value = value;
067: return p;
068: }
069:
070: /**
071: *
072: */
073: public ObjectProperty() {
074: super ();
075: // TODO Auto-generated constructor stub
076: }
077:
078: /**
079: * @param name
080: */
081: public ObjectProperty(String name) {
082: super (name);
083: }
084:
085: public ObjectProperty(String name, Object p) {
086: super (name);
087: value = p;
088: }
089:
090: /*
091: * (non-Javadoc)
092: *
093: * @see org.apache.jmeter.testelement.property.JMeterProperty#getStringValue()
094: */
095: public String getStringValue() {
096: return value.toString();
097: }
098:
099: /*
100: * (non-Javadoc)
101: *
102: * @see org.apache.jmeter.testelement.property.JMeterProperty#getObjectValue()
103: */
104: public Object getObjectValue() {
105: return value;
106: }
107:
108: /*
109: * (non-Javadoc)
110: *
111: * @see org.apache.jmeter.testelement.property.JMeterProperty#setObjectValue(java.lang.Object)
112: */
113: public void setObjectValue(Object value) {
114: this.value = value;
115:
116: }
117: }
|