Module spring.data.neo4j
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 -
Constructor Summary
Constructors -
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)
-
Field Details
-
FUNCTION_LITERAL
-
FUNCTION_ANY_OF
-
FUNCTION_ALL_OF
-
FUNCTION_ORDER_BY
-
-
Constructor Details
-
Neo4jSpelSupport
public Neo4jSpelSupport()
-
-
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) - Parameters:
query- the query expression potentially containing a SpEL expression. Must not be null.metadata- 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
-