/** * Assigns a value to the <code>queryNode</code>. * * @param node must be of type string, decimal, double or integer; otherwise * an InvalidQueryException is added to {@link #exceptions}. * @param queryNode current node in the query tree. */ private void assignValue(SimpleNode node, RelationQueryNode queryNode) { if (node.getId() == JJTSTRINGLITERAL) { queryNode.setStringValue(unescapeQuotes(node.getValue())); } else if (node.getId() == JJTDECIMALLITERAL) { queryNode.setDoubleValue(Double.parseDouble(node.getValue())); } else if (node.getId() == JJTDOUBLELITERAL) { queryNode.setDoubleValue(Double.parseDouble(node.getValue())); } else if (node.getId() == JJTINTEGERLITERAL) { // if this is an expression that contains position() do not change // the type. if (queryNode.getValueType() == QueryConstants.TYPE_POSITION) { queryNode.setPositionValue(Integer.parseInt(node.getValue())); } else { queryNode.setLongValue(Long.parseLong(node.getValue())); } } else { exceptions.add(new InvalidQueryException("Unsupported literal type:" + node.toString())); } }
/** * Assigns a value to the <code>queryNode</code>. * * @param node must be of type string, decimal, double or integer; otherwise * an InvalidQueryException is added to {@link #exceptions}. * @param queryNode current node in the query tree. */ private void assignValue(SimpleNode node, RelationQueryNode queryNode) { if (node.getId() == JJTSTRINGLITERAL) { queryNode.setStringValue(unescapeQuotes(node.getValue())); } else if (node.getId() == JJTDECIMALLITERAL) { queryNode.setDoubleValue(Double.parseDouble(node.getValue())); } else if (node.getId() == JJTDOUBLELITERAL) { queryNode.setDoubleValue(Double.parseDouble(node.getValue())); } else if (node.getId() == JJTINTEGERLITERAL) { // if this is an expression that contains position() do not change // the type. if (queryNode.getValueType() == QueryConstants.TYPE_POSITION) { queryNode.setPositionValue(Integer.parseInt(node.getValue())); } else { queryNode.setLongValue(Long.parseLong(node.getValue())); } } else { exceptions.add(new InvalidQueryException("Unsupported literal type:" + node.toString())); } }
node = factory.createRelationQueryNode(parent, operationType); node.setRelativePath(relPath); node.setLongValue(l); } else if (literal.getType() == QueryConstants.TYPE_STRING) { node = factory.createRelationQueryNode(parent, operationType);
node = factory.createRelationQueryNode(parent, operationType); node.setRelativePath(relPath); node.setLongValue(l); } else if (literal.getType() == QueryConstants.TYPE_STRING) { node = factory.createRelationQueryNode(parent, operationType);