Skip to content

Commit

Permalink
Support for String method .contains()
Browse files Browse the repository at this point in the history
  • Loading branch information
hopecee committed Jan 17, 2018
1 parent 45b7dcc commit 7eca91a
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,23 @@ else if (neo4jExprArgs.size() == 1)
return neo4jExpr;
}
}
else if ("contains".equals(operation)) {
if (args != null && args.size() == 1) {
if (args.get(0) instanceof Literal) {
Literal literalValue = (Literal) args.get(0);
Neo4jLiteral neo4jLiteral = new Neo4jLiteral(literalValue.getLiteral());
Operator OP_CONTAINS = new Operator("=~", 6);
Neo4jExpression neo4jExpr = new Neo4jBooleanExpression(invokedFieldExpr, neo4jLiteral, OP_CONTAINS);
stack.push(neo4jExpr);
return neo4jExpr;
} else {
// throw new NucleusException("");
}
} else {
throw new NucleusException("Method String.contains has to have 1 args");
}
}

}
else if (Numeric.class.isAssignableFrom(invokedFieldExpr.getMemberMetaData().getType()))
{
Expand Down Expand Up @@ -1066,4 +1083,4 @@ else if (RelationType.isRelationMultiValued(relationType))

return null;
}
}
}

0 comments on commit 7eca91a

Please sign in to comment.