1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.jxpath.ri;
18
19 import java.util.Iterator;
20
21 import org.apache.commons.jxpath.ri.compiler.Expression;
22 import org.apache.commons.jxpath.CompiledExpression;
23 import org.apache.commons.jxpath.JXPathContext;
24 import org.apache.commons.jxpath.Pointer;
25
26
27
28
29
30
31
32 public class JXPathCompiledExpression implements CompiledExpression {
33
34 private String xpath;
35 private Expression expression;
36
37
38
39
40
41
42 public JXPathCompiledExpression(String xpath, Expression expression) {
43 this.xpath = xpath;
44 this.expression = expression;
45 }
46
47
48
49
50
51 protected String getXPath() {
52 return xpath;
53 }
54
55
56
57
58
59 protected Expression getExpression() {
60 return expression;
61 }
62
63 public String toString() {
64 return xpath;
65 }
66
67 public Object getValue(JXPathContext context) {
68 return ((JXPathContextReferenceImpl) context).
69 getValue(xpath, expression);
70 }
71
72 public Object getValue(JXPathContext context, Class requiredType) {
73 return ((JXPathContextReferenceImpl) context).
74 getValue(xpath, expression, requiredType);
75 }
76
77 public void setValue(JXPathContext context, Object value) {
78 ((JXPathContextReferenceImpl) context).
79 setValue(xpath, expression, value);
80 }
81
82 public Pointer createPath(JXPathContext context) {
83 return ((JXPathContextReferenceImpl) context).
84 createPath(xpath, expression);
85 }
86
87 public Pointer createPathAndSetValue(JXPathContext context, Object value) {
88 return ((JXPathContextReferenceImpl) context).
89 createPathAndSetValue(xpath, expression, value);
90 }
91
92 public Iterator iterate(JXPathContext context) {
93 return ((JXPathContextReferenceImpl) context).
94 iterate(xpath, expression);
95 }
96
97 public Pointer getPointer(JXPathContext context, String xpath) {
98 return ((JXPathContextReferenceImpl) context).
99 getPointer(xpath, expression);
100 }
101
102 public Iterator iteratePointers(JXPathContext context) {
103 return ((JXPathContextReferenceImpl) context).
104 iteratePointers(xpath, expression);
105 }
106
107 public void removePath(JXPathContext context) {
108 ((JXPathContextReferenceImpl) context).removePath(xpath, expression);
109 }
110
111 public void removeAll(JXPathContext context) {
112 ((JXPathContextReferenceImpl) context).removeAll(xpath, expression);
113 }
114 }