Class Neo4jSpelSupport
java.lang.Object
org.springframework.data.neo4j.repository.query.Neo4jSpelSupport
This class provides a couple of extensions to the Spring Data Neo4j SpEL support. Its
static functions are registered inside an
EvaluationContextExtension that in turn will
be provided as a root bean.- Since:
- 6.0.2
- Author:
- Michael J. Simons
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA marker interface that indicates a literal replacement in a query instead of a parameter replacement. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionTurns the arguments of this function into a literal replacement for the SpEL placeholder (instead of creating Cypher parameters).Takesargand tries to either extract asortfrom it or cast it to a sort.static StringrenderQueryIfExpressionOrReturnQuery(String query, Neo4jMappingContext mappingContext, EntityMetadata<?> metadata, ValueExpressionParser parser) Renders a query that may contains SpEL expressions.
-
Field Details
-
FUNCTION_LITERAL
Constant under which literal functions are registered. -
FUNCTION_ANY_OF
Constant for theanyOfexpression. -
FUNCTION_ALL_OF
Constant for theallOfexpression. -
FUNCTION_ORDER_BY
Constant for theorderByexpression.
-
-
Method Details
-
orderBy
Takesargand tries to either extract asortfrom it or cast it to a sort. That sort is than past to theCypherGeneratorthat renders a valid order by fragment which replaces the SpEL placeholder without further validation whether it's attributes are in the query or similar literal.- Parameters:
arg- thesort objectto order the result set of the final query.- Returns:
- a literal replacement for a SpEL placeholder
-
literal
Turns the arguments of this function into a literal replacement for the SpEL placeholder (instead of creating Cypher parameters).- Parameters:
arg- the object that will be inserted as a literal String into the query. It'stoString()method will be used.- Returns:
- a literal replacement for a SpEL placeholder
-
anyOf
-
allOf
-
renderQueryIfExpressionOrReturnQuery
public static String renderQueryIfExpressionOrReturnQuery(String query, Neo4jMappingContext mappingContext, EntityMetadata<?> metadata, ValueExpressionParser parser) Renders a query that may contains SpEL expressions.- Parameters:
query- the query expression potentially containing a SpEL expression. Must not be null.mappingContext- the mapping context in which the query is renderedmetadata- theNeo4jPersistentEntityfor the given entity. Must not be null.parser- must not be null.- Returns:
- a query in which some SpEL expression have been replaced with the result of evaluating the expression
-