public class StringBasedN1qlQueryParser extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
StringBasedN1qlQueryParser.N1qlSpelValues
This class is exposed to SpEL parsing through the variable
#. |
| Modifier and Type | Field and Description |
|---|---|
static Pattern |
NAMED_PLACEHOLDER_PATTERN
regexp that detect $named placeholder (starts with a letter, then alphanum chars)
|
N1QLExpression |
parsedExpression |
static Pattern |
POSITIONAL_PLACEHOLDER_PATTERN
regexp that detect positional placeholder ($ followed by digits only)
|
static Pattern |
QUOTE_DETECTION_PATTERN
regexp that detects " and ' quote boundaries, ignoring escaped quotes
|
static String |
SPEL_BUCKET
Use this variable in a SpEL expression in a
@Query annotation's inline statement. |
static String |
SPEL_COLLECTION
Use this variable in a SpEL expression in a
@Query annotation's inline statement. |
static String |
SPEL_DELETE
Use this variable in a SpEL expression in a
@Query annotation's inline statement. |
static String |
SPEL_ENTITY
Use this variable in a SpEL expression in a
@Query annotation's inline statement. |
static Pattern |
SPEL_EXPRESSION_PATTERN
regexp that detect SPEL Expression (#{..})
|
static String |
SPEL_FILTER
Use this variable in a SpEL expression in a
@Query annotation's inline statement WHERE clause. |
static String |
SPEL_PREFIX |
static String |
SPEL_RETURNING
Use this variable in a SpEL expression in a
@Query annotation's inline statement. |
static String |
SPEL_SCOPE
Use this variable in a SpEL expression in a
@Query annotation's inline statement. |
static String |
SPEL_SELECT_FROM_CLAUSE
Use this variable in a SpEL expression in a
@Query annotation's inline statement. |
| Constructor and Description |
|---|
StringBasedN1qlQueryParser(String statement,
CouchbaseQueryMethod queryMethod,
String bucketName,
String scope,
String collection,
CouchbaseConverter couchbaseConverter,
String typeField,
String typeValue,
org.springframework.data.repository.query.ParameterAccessor accessor,
SpelExpressionParser spelExpressionParser,
org.springframework.data.repository.query.QueryMethodEvaluationContextProvider evaluationContextProvider)
This constructor is to allow for generating the n1ql spel expressions from @Queries.
|
StringBasedN1qlQueryParser(String bucketName,
String scope,
String collection,
CouchbaseConverter couchbaseConverter,
Class<?> domainClass,
Class<?> resultClass,
String typeField,
String typeValue,
boolean isCount,
String[] distinctFields,
String[] fields)
This constructor is to allow for generating the n1ql spel expressions from NON-@Queries.
|
| Modifier and Type | Method and Description |
|---|---|
StringBasedN1qlQueryParser.N1qlSpelValues |
createN1qlSpelValues(String bucketName,
String scope,
String collection,
Class domainClass,
String typeField,
String typeValue,
boolean isCount,
String[] distinctFields,
String[] fields)
Create the n1ql spel values.
|
static String |
doParse(String statement,
SpelExpressionParser parser,
EvaluationContext evaluationContext,
StringBasedN1qlQueryParser.N1qlSpelValues n1qlSpelValues) |
N1QLExpression |
getExpression(String statement,
CouchbaseQueryMethod queryMethod,
org.springframework.data.repository.query.ParameterAccessor accessor,
SpelExpressionParser parser,
org.springframework.data.repository.query.QueryMethodEvaluationContextProvider evaluationContextProvider)
Creates the N1QLExpression and parameterNames
|
com.couchbase.client.java.json.JsonValue |
getPlaceholderValues(org.springframework.data.repository.query.ParameterAccessor accessor) |
String |
getStatement() |
StringBasedN1qlQueryParser.N1qlSpelValues |
getStatementContext() |
protected boolean |
useGeneratedCountQuery() |
public static final String SPEL_PREFIX
public static final String SPEL_SELECT_FROM_CLAUSE
@Query annotation's inline statement. This will be
replaced by the correct SELECT x FROM y clause needed for entity mapping. Eg.
"#{"#n1ql.selectEntity"} WHERE test = true". Note this only makes sense once, as the
beginning of the statement.public static final String SPEL_BUCKET
@Query annotation's inline statement. This will be
replaced by the (escaped) bucket name corresponding to the repository's entity. Eg.
"SELECT * FROM #{"#n1ql.bucket"} LIMIT 3".public static final String SPEL_SCOPE
@Query annotation's inline statement. This will be
replaced by the (escaped) scope name. Eg.
"SELECT * FROM #{"#n1ql.scope"}.#{"#n1ql.collection"} LIMIT 3".public static final String SPEL_COLLECTION
@Query annotation's inline statement. This will be
replaced by the (escaped) collection name. Eg.
"SELECT * FROM #{"#n1ql.scope"}.#{"#n1ql.collection"} LIMIT 3".public static final String SPEL_ENTITY
@Query annotation's inline statement. This will be
replaced by the fields allowing to construct the repository's entity (SELECT clause). Eg.
"SELECT #{"#n1ql.fields"} FROM test".public static final String SPEL_FILTER
@Query annotation's inline statement WHERE clause. This
will be replaced by the expression allowing to only select documents matching the entity's class. Eg.
"SELECT * FROM test WHERE test = true AND #{"#n1ql.filter"}".public static final String SPEL_DELETE
@Query annotation's inline statement. This will be
replaced by the correct delete expression needed Eg.
"#{"#n1ql.delete"} WHERE test = true". Note this only makes sense once, as the beginning of the
statement.public static final String SPEL_RETURNING
@Query annotation's inline statement. This will be
replaced by the correct returning clause needed for entity mapping. Eg.
"#{"#n1ql.returning"} WHERE test = true". Note this only makes sense once, as the beginning of
the statement.public static final Pattern NAMED_PLACEHOLDER_PATTERN
public static final Pattern POSITIONAL_PLACEHOLDER_PATTERN
public static final Pattern SPEL_EXPRESSION_PATTERN
public static final Pattern QUOTE_DETECTION_PATTERN
public final N1QLExpression parsedExpression
public StringBasedN1qlQueryParser(String statement, CouchbaseQueryMethod queryMethod, String bucketName, String scope, String collection, CouchbaseConverter couchbaseConverter, String typeField, String typeValue, org.springframework.data.repository.query.ParameterAccessor accessor, SpelExpressionParser spelExpressionParser, org.springframework.data.repository.query.QueryMethodEvaluationContextProvider evaluationContextProvider)
statement - queryMethod - bucketName - scope - collection - couchbaseConverter - typeField - typeValue - accessor - spelExpressionParser - evaluationContextProvider - public StringBasedN1qlQueryParser(String bucketName, String scope, String collection, CouchbaseConverter couchbaseConverter, Class<?> domainClass, Class<?> resultClass, String typeField, String typeValue, boolean isCount, String[] distinctFields, String[] fields)
bucketName - scope - collection - couchbaseConverter - domainClass - resultClass - typeField - typeValue - isCount - distinctFields - fields - public StringBasedN1qlQueryParser.N1qlSpelValues createN1qlSpelValues(String bucketName, String scope, String collection, Class domainClass, String typeField, String typeValue, boolean isCount, String[] distinctFields, String[] fields)
bucketName - scope - collection - domainClass - typeField - typeValue - isCount - distinctFields - fields - public static String doParse(String statement, SpelExpressionParser parser, EvaluationContext evaluationContext, StringBasedN1qlQueryParser.N1qlSpelValues n1qlSpelValues)
public com.couchbase.client.java.json.JsonValue getPlaceholderValues(org.springframework.data.repository.query.ParameterAccessor accessor)
protected boolean useGeneratedCountQuery()
public StringBasedN1qlQueryParser.N1qlSpelValues getStatementContext()
public String getStatement()
public N1QLExpression getExpression(String statement, CouchbaseQueryMethod queryMethod, org.springframework.data.repository.query.ParameterAccessor accessor, SpelExpressionParser parser, org.springframework.data.repository.query.QueryMethodEvaluationContextProvider evaluationContextProvider)
statement - queryMethod - accessor - parser - evaluationContextProvider - Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.