View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2008 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by 
6    *  the Free Software Foundation.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.soapui.impl.wsdl.teststeps;
14  
15  import java.lang.reflect.InvocationTargetException;
16  
17  import org.apache.commons.beanutils.BeanUtils;
18  
19  import com.eviware.soapui.impl.wsdl.AbstractWsdlModelItem;
20  
21  public class BeanPathPropertySupport extends AbstractPathPropertySupport
22  {
23  	private Object config;
24  
25  	public BeanPathPropertySupport(AbstractWsdlModelItem<?> modelItem, String propertyName)
26  	{
27  		this( modelItem, modelItem.getConfig(), propertyName );
28  	}
29  	
30  	public BeanPathPropertySupport(AbstractWsdlModelItem<?> modelItem, Object config, String propertyName)
31  	{
32  		super( modelItem, propertyName );
33  		this.config = config;
34  	}
35  
36  	public void setPropertyValue(String value) throws IllegalAccessException, InvocationTargetException
37  	{
38  		BeanUtils.setProperty(config, getPropertyName(), value );
39  	}
40  
41  	public String getPropertyValue() throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
42  	{
43  		return BeanUtils.getProperty(config, getPropertyName());
44  	}
45  
46  	public void setConfig(Object config)
47  	{
48  		this.config = config;
49  	}
50  }