use of org.apache.commons.jexl2.parser.ASTNumberLiteral in project datawave by NationalSecurityAgency.
the class JexlNodeFactory method buildUntypedNewNode.
/**
* Build a JexlNode with a Number literal
*
* @param fieldName
* @param fieldValue
* @return
*/
protected static JexlNode buildUntypedNewNode(JexlNode newNode, ASTIdentifier fieldName, Number fieldValue) {
ASTNumberLiteral literal = new ASTNumberLiteral(ParserTreeConstants.JJTNUMBERLITERAL);
literal.image = fieldValue.toString();
if (NATURAL_NUMBERS.contains(fieldValue.getClass())) {
literal.setNatural(fieldValue.toString());
} else if (REAL_NUMBERS.contains(fieldValue.getClass())) {
literal.setReal(fieldValue.toString());
} else {
QueryException qe = new QueryException(DatawaveErrorCode.ASTNUMBERLITERAL_TYPE_ASCERTAIN_ERROR, MessageFormat.format("{0}", literal));
throw new DatawaveFatalQueryException(qe);
}
return buildUntypedNewNode(newNode, fieldName, literal);
}
Aggregations