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 N1QLN1qlQuery.- Since:
- 2.1
- Author:
- Simon Baslé
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractN1qlQuery(Statement statement, N1qlParams params)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description JsonObjectn1ql()Convert this query to a full N1QL query in Json form.N1qlParamsparams()Returns theN1qlParamsrepresenting customization of the N1QL query.static voidpopulateParameters(JsonObject query, JsonValue params)Populate aJsonObjectrepresentation of a query with parameters, either positional or named.Statementstatement()Returns theStatementfrom this query.protected abstract JsonValuestatementParameters()The parameters to inject in the query, null or empty to ignore.protected abstract StringstatementType()The type of the statement, used as JSON name in the final JSON form of the queryprotected abstract ObjectstatementValue()The JSON representation for the underlyingStatementin the final JSON form of the query-
Methods inherited from class com.couchbase.client.java.query.N1qlQuery
parameterized, parameterized, parameterized, parameterized, parameterized, parameterized, parameterized, parameterized, simple, simple, simple, simple
-
-
-
-
Constructor Detail
-
AbstractN1qlQuery
protected AbstractN1qlQuery(Statement statement, N1qlParams params)
-
-
Method Detail
-
statementType
protected abstract String statementType()
The type of the statement, used as JSON name in the final JSON form of the query
-
statementValue
protected abstract Object statementValue()
The JSON representation for the underlyingStatementin the final JSON form of the query
-
statementParameters
protected abstract JsonValue statementParameters()
The parameters to inject in the query, null or empty to ignore.
-
params
public N1qlParams params()
Description copied from class:N1qlQueryReturns theN1qlParamsrepresenting customization of the N1QL query. Note that this is different from named or positional parameters (which relate to the statement).- Specified by:
paramsin classN1qlQuery- Returns:
- the
N1qlParamsfor this query, null if none.
-
statement
public Statement statement()
Description copied from class:N1qlQueryReturns theStatementfrom this query. Note that this is the only mandatory part of a N1QL query.
-
n1ql
public JsonObject n1ql()
Description copied from class:N1qlQueryConvert this query to a full N1QL query in Json form.
-
populateParameters
public static void populateParameters(JsonObject query, JsonValue params)
Populate aJsonObjectrepresentation 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 theJsonValueshould not be mutated untiln1ql()is called since it backs the creation of the query string. Also, theStatementis expected to contain the correct placeholders (corresponding names and number).- Parameters:
query- the query JsonObject to populated with parameters.params- the parameters.
-
-