1 19 20 package org.netbeans.modules.xml.xpath.impl; 21 22 import org.apache.commons.jxpath.ri.compiler.VariableReference; 23 import org.netbeans.modules.xml.xpath.AbstractXPathModelHelper; 24 import org.netbeans.modules.xml.xpath.LocationStep; 25 import org.netbeans.modules.xml.xpath.XPathCoreFunction; 26 import org.netbeans.modules.xml.xpath.XPathCoreOperation; 27 import org.netbeans.modules.xml.xpath.XPathExpression; 28 import org.netbeans.modules.xml.xpath.XPathExpressionPath; 29 import org.netbeans.modules.xml.xpath.XPathExtensionFunction; 30 import org.netbeans.modules.xml.xpath.XPathLocationPath; 31 import org.netbeans.modules.xml.xpath.XPathModel; 32 import org.netbeans.modules.xml.xpath.XPathNumericLiteral; 33 import org.netbeans.modules.xml.xpath.XPathPredicateExpression; 34 import org.netbeans.modules.xml.xpath.XPathPredicateNumericLiteral; 35 import org.netbeans.modules.xml.xpath.XPathStringLiteral; 36 import org.netbeans.modules.xml.xpath.XPathVariableReference; 37 import org.netbeans.modules.xml.xpath.function.extension.GetContainerDataFunction; 38 import org.netbeans.modules.xml.xpath.function.extension.impl.GetContainerDataFunctionImpl; 39 40 41 42 48 public class XPathModelHelperImpl extends AbstractXPathModelHelper { 49 50 54 public XPathModel newXPathModel() { 55 return new XPathModelImpl(); 56 } 57 58 59 64 public XPathStringLiteral newXPathStringLiteral(String value) { 65 return new XPathStringLiteralImpl(value); 66 } 67 68 73 public XPathVariableReference newXPathVariableReference(VariableReference vReference) { 74 75 return new XPathVariableReferenceImpl(vReference); 76 } 77 78 79 84 public XPathPredicateExpression newXPathPredicateExpression(XPathExpression expression) { 85 return new XPathPredicateExpressionImpl(expression); 86 } 87 88 89 94 public XPathNumericLiteral newXPathNumericLiteral(Number value) { 95 return new XPathNumericLiteralImpl(value); 96 } 97 98 103 public XPathPredicateNumericLiteral newXPathPredicateNumericLiteral(Long value) { 104 return new XPathPredicateNumericLiteralImpl(value); 105 } 106 107 112 public XPathCoreFunction newXPathCoreFunction(int function) { 113 return new XPathCoreFunctionImpl(function); 114 } 115 116 117 122 public XPathExtensionFunction newXPathExtensionFunction( 123 String name) { 124 if(name != null && name.equals(GetContainerDataFunction.NAME)) { 125 return new GetContainerDataFunctionImpl(name); 126 } else { 127 return new XPathExtensionFunctionImpl(name); 128 } 129 } 130 131 132 137 public XPathCoreOperation newXPathCoreOperation(int code) { 138 return new XPathCoreOperationImpl(code); 139 } 140 141 142 147 public XPathLocationPath newXPathLocationPath(LocationStep[] steps) { 148 return new XPathLocationPathImpl(steps); 149 } 150 151 157 public XPathExpressionPath newXPathExpressionPath(XPathExpression rootExpression, 158 LocationStep[] steps) { 159 160 return new XPathExpressionPathImpl(rootExpression, steps, false); 161 } 162 163 169 public boolean isValidFunction(String functionName) { 170 return XPathModelImpl.isValidFunction(functionName); 171 } 172 173 179 public boolean isValidOperator(String operatorName) { 180 if(opHash != null && opHash.keySet().contains(operatorName)) { 181 return true; 182 } 183 184 return false; 185 } 186 } 187 | Popular Tags |