protected void getXPathReturnType( final XPathReturnType returnType, final ExpressionBuilder expBuilder) { switch (returnType) { case BOOLEAN: expBuilder.setReturnType(Boolean.class.getName()); break; case DOUBLE: expBuilder.setReturnType(Double.class.getName()); break; case NODE: expBuilder.setReturnType(Node.class.getName()); break; case NODE_LIST: expBuilder.setReturnType(NodeList.class.getName()); break; case STRING: expBuilder.setReturnType(String.class.getName()); break; case FLOAT: expBuilder.setReturnType(Float.class.getName()); break; case INTEGER: expBuilder.setReturnType(Integer.class.getName()); break; case LONG: expBuilder.setReturnType(Long.class.getName()); break; default: break; } }
public Expression createXPathExpression( final String name, final String xPathExpression, final XPathReturnType returnType, final String xmlContent) throws InvalidExpressionException { final ExpressionBuilder expBuilder = createNewInstance(name) .setExpressionType(ExpressionType.TYPE_XPATH_READ) .setContent(xPathExpression); getXPathReturnType(returnType, expBuilder); final Expression dep = new ExpressionBuilder() .createNewInstance("xmlContent") .setContent(xmlContent) .setExpressionType(ExpressionType.TYPE_CONSTANT) .setReturnType(String.class.getName()) .done(); expBuilder.setDependencies(Arrays.asList(dep)); return expBuilder.done(); }