1 16 package org.apache.commons.jxpath.ri; 17 18 import java.util.Iterator ; 19 20 import org.apache.commons.jxpath.ri.compiler.Expression; 21 import org.apache.commons.jxpath.CompiledExpression; 22 import org.apache.commons.jxpath.JXPathContext; 23 import org.apache.commons.jxpath.Pointer; 24 25 31 public class JXPathCompiledExpression implements CompiledExpression { 32 33 private String xpath; 34 private Expression expression; 35 36 public JXPathCompiledExpression(String xpath, Expression expression) { 37 this.xpath = xpath; 38 this.expression = expression; 39 } 40 41 protected String getXPath() { 42 return xpath; 43 } 44 45 protected Expression getExpression() { 46 return expression; 47 } 48 49 public String toString() { 50 return xpath; 51 } 52 53 56 public Object getValue(JXPathContext context) { 57 return ((JXPathContextReferenceImpl) context). 58 getValue(xpath, expression); 59 } 60 61 64 public Object getValue(JXPathContext context, Class requiredType) { 65 return ((JXPathContextReferenceImpl) context). 66 getValue(xpath, expression, requiredType); 67 } 68 69 72 public void setValue(JXPathContext context, Object value) { 73 ((JXPathContextReferenceImpl) context). 74 setValue(xpath, expression, value); 75 } 76 77 80 public Pointer createPath(JXPathContext context) { 81 return ((JXPathContextReferenceImpl) context). 82 createPath(xpath, expression); 83 } 84 85 88 public Pointer createPathAndSetValue(JXPathContext context, Object value) { 89 return ((JXPathContextReferenceImpl) context). 90 createPathAndSetValue(xpath, expression, value); 91 } 92 93 96 public Iterator iterate(JXPathContext context) { 97 return ((JXPathContextReferenceImpl) context). 98 iterate(xpath, expression); 99 } 100 101 104 public Pointer getPointer(JXPathContext context, String xpath) { 105 return ((JXPathContextReferenceImpl) context). 106 getPointer(xpath, expression); 107 } 108 109 112 public Iterator iteratePointers(JXPathContext context) { 113 return ((JXPathContextReferenceImpl) context). 114 iteratePointers(xpath, expression); 115 } 116 117 120 public void removePath(JXPathContext context) { 121 ((JXPathContextReferenceImpl) context).removePath(xpath, expression); 122 } 123 124 127 public void removeAll(JXPathContext context) { 128 ((JXPathContextReferenceImpl) context).removeAll(xpath, expression); 129 } 130 } 131 | Popular Tags |