Search in sources :

Example 1 with EvaluationException

use of org.neo4j.cypher.internal.evaluator.EvaluationException in project neo4j by neo4j.

the class ShellParameterMap method setParameter.

@Override
public Object setParameter(@Nonnull String name, @Nonnull String valueString) throws ParameterException {
    String parameterName = CypherVariablesFormatter.unescapedCypherVariable(name);
    try {
        Object value = new Cypher(interpreter, ParameterException.FACTORY, new CypherCharStream(valueString)).Expression();
        queryParams.put(parameterName, new ParamValue(valueString, toJavaObject(value)));
        return value;
    } catch (ParseException | UnsupportedOperationException e) {
        try {
            Object value = evaluator.evaluate(valueString, Object.class);
            queryParams.put(parameterName, new ParamValue(valueString, toJavaObject(value)));
            return value;
        } catch (EvaluationException e1) {
            throw new ParameterException(e1.getMessage());
        }
    }
}
Also used : Cypher(org.neo4j.cypher.internal.parser.javacc.Cypher) ParamValue(org.neo4j.shell.state.ParamValue) CypherCharStream(org.neo4j.cypher.internal.parser.javacc.CypherCharStream) ParameterException(org.neo4j.shell.exception.ParameterException) ParseException(org.neo4j.cypher.internal.parser.javacc.ParseException) EvaluationException(org.neo4j.cypher.internal.evaluator.EvaluationException)

Aggregations

EvaluationException (org.neo4j.cypher.internal.evaluator.EvaluationException)1 Cypher (org.neo4j.cypher.internal.parser.javacc.Cypher)1 CypherCharStream (org.neo4j.cypher.internal.parser.javacc.CypherCharStream)1 ParseException (org.neo4j.cypher.internal.parser.javacc.ParseException)1 ParameterException (org.neo4j.shell.exception.ParameterException)1 ParamValue (org.neo4j.shell.state.ParamValue)1