Interface RefactoringContext
public interface RefactoringContext
A wrapper around access to a Neo4j database. It requires an implementation of a simplified
based on official Neo4j driver types.
- Since:
- 1.10.0
- Author:
- Michael J. Simons
- Soundtrack
- FiNCH - Rummelbums
-
Method Summary
Modifier and TypeMethodDescriptionfindSingleResultIdentifier
(String query) Looks if the query would potentially return a single, identifiable element that can be used as a source element in a refactoring.getQueryRunner
(QueryRunner.FeatureSet featureSet) Returns a simplified query runner with the given feature set.default String
sanitizeSchemaName
(String potentiallyNonIdentifier) Escapes the string potentiallyNonIdentifier in all cases when it's not a valid Cypher identifier in the given context
-
Method Details
-
findSingleResultIdentifier
Looks if the query would potentially return a single, identifiable element that can be used as a source element in a refactoring. Implementing classes can use EXPLAIN but also tooling like Cypher-DSL to evaluate the query.- Parameters:
query
- The query to evaluate- Returns:
- An optional containing the single result of a query if any
-
getQueryRunner
Returns a simplified query runner with the given feature set. If a context cannot satisfy the feature set it is supposed to throw anIllegalArgumentException
.- Parameters:
featureSet
- Required feature set- Returns:
- A query runner supporting the given feature set
- Throws:
IllegalArgumentException
- In case feature set cannot be satisfiedIllegalStateException
- In case there is no defined version in this context
-
sanitizeSchemaName
Escapes the string potentiallyNonIdentifier in all cases when it's not a valid Cypher identifier in the given context- Parameters:
potentiallyNonIdentifier
- A value to escape, must not be null or blank- Returns:
- The sanitized and quoted value or the same value if no change is necessary.
- Since:
- 1.11.0
-