Package com.couchbase.client.java.query
Class AbstractN1qlQuery
java.lang.Object
com.couchbase.client.java.query.N1qlQuery
com.couchbase.client.java.query.AbstractN1qlQuery
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ParameterizedN1qlQuery
,SimpleN1qlQuery
public abstract class AbstractN1qlQuery extends N1qlQuery
An abstract base for N1QL
N1qlQuery
.- Since:
- 2.1
- Author:
- Simon Baslé
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractN1qlQuery(Statement statement, N1qlParams params)
-
Method Summary
Modifier and Type Method Description JsonObject
n1ql()
Convert this query to a full N1QL query in Json form.N1qlParams
params()
Returns theN1qlParams
representing customization of the N1QL query.static void
populateParameters(JsonObject query, JsonValue params)
Populate aJsonObject
representation of a query with parameters, either positional or named.Statement
statement()
Returns theStatement
from this query.protected abstract JsonValue
statementParameters()
The parameters to inject in the query, null or empty to ignore.protected abstract String
statementType()
The type of the statement, used as JSON name in the final JSON form of the queryprotected abstract Object
statementValue()
The JSON representation for the underlyingStatement
in the final JSON form of the queryMethods inherited from class com.couchbase.client.java.query.N1qlQuery
parameterized, parameterized, parameterized, parameterized, parameterized, parameterized, parameterized, parameterized, simple, simple, simple, simple
-
Constructor Details
-
AbstractN1qlQuery
-
-
Method Details
-
statementType
The type of the statement, used as JSON name in the final JSON form of the query -
statementValue
The JSON representation for the underlyingStatement
in the final JSON form of the query -
statementParameters
The parameters to inject in the query, null or empty to ignore. -
params
Description copied from class:N1qlQuery
Returns theN1qlParams
representing customization of the N1QL query. Note that this is different from named or positional parameters (which relate to the statement).- Specified by:
params
in classN1qlQuery
- Returns:
- the
N1qlParams
for this query, null if none.
-
statement
Description copied from class:N1qlQuery
Returns theStatement
from this query. Note that this is the only mandatory part of a N1QL query. -
n1ql
Description copied from class:N1qlQuery
Convert this query to a full N1QL query in Json form. -
populateParameters
Populate aJsonObject
representation of a query with parameters, either positional or named. - If params is aJsonObject
, named parameters will be used (prefixing the names with '$' if not present). - If params is aJsonArray
, positional parameters will be used. - If params is null or an empty json, no parameters are populated in the query object. Note that theJsonValue
should not be mutated untiln1ql()
is called since it backs the creation of the query string. Also, theStatement
is expected to contain the correct placeholders (corresponding names and number).- Parameters:
query
- the query JsonObject to populated with parameters.params
- the parameters.
-