Class AbstractN1qlQuery

All Implemented Interfaces:
Direct Known Subclasses:
ParameterizedN1qlQuery, SimpleN1qlQuery

public abstract class AbstractN1qlQuery
extends N1qlQuery
An abstract base for N1QL N1qlQuery.
Simon Baslé
See Also:
Serialized Form
  • Constructor Details

  • Method Details

    • 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 underlying Statement in 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: N1qlQuery
      Returns the N1qlParams 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 class N1qlQuery
      the N1qlParams for this query, null if none.
    • statement

      public Statement statement()
      Description copied from class: N1qlQuery
      Returns the Statement from this query. Note that this is the only mandatory part of a N1QL query.
      Specified by:
      statement in class N1qlQuery
      the statement that forms the base of this query
    • n1ql

      public JsonObject n1ql()
      Description copied from class: N1qlQuery
      Convert this query to a full N1QL query in Json form.
      Specified by:
      n1ql in class N1qlQuery
      the json representation of this query (including all relevant parameters)
    • populateParameters

      public static void populateParameters​(JsonObject query, JsonValue params)
      Populate a JsonObject representation of a query with parameters, either positional or named. - If params is a JsonObject, named parameters will be used (prefixing the names with '$' if not present). - If params is a JsonArray, positional parameters will be used. - If params is null or an empty json, no parameters are populated in the query object. Note that the JsonValue should not be mutated until n1ql() is called since it backs the creation of the query string. Also, the Statement is expected to contain the correct placeholders (corresponding names and number).
      query - the query JsonObject to populated with parameters.
      params - the parameters.