1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.model.support;
14
15 import org.apache.commons.beanutils.PropertyUtils;
16
17 import com.eviware.soapui.SoapUI;
18 import com.eviware.soapui.model.testsuite.TestProperty;
19
20 public class XPathReferenceImpl implements XPathReference
21 {
22 private String label;
23 private TestProperty targetProperty;
24 private Object target;
25 private String xpathPropertyName;
26 private String xpath;
27
28 public XPathReferenceImpl( String label, TestProperty targetProperty, Object target, String xpathPropertyName )
29 {
30 this.label = label;
31 this.targetProperty = targetProperty;
32 this.target = target;
33 this.xpathPropertyName = xpathPropertyName;
34
35 try
36 {
37 this.xpath = ( String ) PropertyUtils.getProperty( target, xpathPropertyName );
38 }
39 catch( Exception e )
40 {
41 SoapUI.logError( e );
42 }
43 }
44
45 public String getLabel()
46 {
47 return label;
48 }
49
50 public TestProperty getTargetProperty()
51 {
52 return targetProperty;
53 }
54
55 public String getXPath()
56 {
57 return xpath;
58 }
59
60 public void setXPath( String xpath )
61 {
62 this.xpath = xpath;
63 }
64
65 public void update()
66 {
67 try
68 {
69 PropertyUtils.setProperty( target, xpathPropertyName, xpath );
70 }
71 catch( Exception e )
72 {
73 SoapUI.logError( e );
74 }
75 }
76 }