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
Modifier and TypeClassDescriptionstatic interface
A marker interface that indicates a literal replacement in a query instead of a parameter replacement. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionTurns the arguments of this function into a literal replacement for the SpEL placeholder (instead of creating Cypher parameters).Takesarg
and tries to either extract asort
from it or cast it to a sort.static String
renderQueryIfExpressionOrReturnQuery
(String query, Neo4jMappingContext mappingContext, EntityMetadata<?> metadata, SpelExpressionParser parser)
-
Field Details
-
FUNCTION_LITERAL
-
FUNCTION_ANY_OF
-
FUNCTION_ALL_OF
-
FUNCTION_ORDER_BY
-
-
Constructor Details
-
Neo4jSpelSupport
public Neo4jSpelSupport()
-
-
Method Details
-
orderBy
Takesarg
and tries to either extract asort
from it or cast it to a sort. That sort is than past to theCypherGenerator
that 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 object
to 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, SpelExpressionParser parser) - Parameters:
query
- the query expression potentially containing a SpEL expression. Must not be null.metadata
- theNeo4jPersistentEntity
for 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
-