Skip to content

Commit

Permalink
Support for String.startsWith() and .endsWith()
Browse files Browse the repository at this point in the history
  • Loading branch information
hopecee committed Jan 19, 2018
1 parent 9451f2b commit b417653
Showing 1 changed file with 37 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -956,17 +956,49 @@ else if ("matches".equals(operation))
if (neo4jExprArgs == null || neo4jExprArgs.isEmpty() || neo4jExprArgs.size() > 2)
{
throw new NucleusException("Method String.matches has to have 1 args");
}
else
{
}
else
{
String propName = invokedFieldExpr.getFieldName();
String value = neo4jExprArgs.get(0).toString();
String cypherText = propName + " =~ '" + value + "'";
Neo4jExpression neo4jExpr = new Neo4jBooleanExpression(cypherText);
stack.push(neo4jExpr);
return neo4jExpr;
}
}
}
}
else if ("startsWith".equals(operation))
{
if (neo4jExprArgs == null || neo4jExprArgs.isEmpty() || neo4jExprArgs.size() > 2)
{
throw new NucleusException("Method String.matches has to have 1 args");
}
else
{
String propName = invokedFieldExpr.getFieldName();
String value = neo4jExprArgs.get(0).toString();
String cypherText = propName + " STARTS WITH '" + value + "'";
Neo4jExpression neo4jExpr = new Neo4jBooleanExpression(cypherText);
stack.push(neo4jExpr);
return neo4jExpr;
}
}
else if ("endsWith".equals(operation))
{
if (neo4jExprArgs == null || neo4jExprArgs.isEmpty() || neo4jExprArgs.size() > 2)
{
throw new NucleusException("Method String.matches has to have 1 args");
}
else
{
String propName = invokedFieldExpr.getFieldName();
String value = neo4jExprArgs.get(0).toString();
String cypherText = propName + " ENDS WITH '" + value + "'";
Neo4jExpression neo4jExpr = new Neo4jBooleanExpression(cypherText);
stack.push(neo4jExpr);
return neo4jExpr;
}
}
else if (Numeric.class.isAssignableFrom(invokedFieldExpr.getMemberMetaData().getType()))
{
}
Expand Down

0 comments on commit b417653

Please sign in to comment.