Class AnalyticsParams
java.lang.Object
com.couchbase.client.java.analytics.AnalyticsParams
- All Implemented Interfaces:
Serializable
@Committed @Public public class AnalyticsParams extends Object implements Serializable
Parameters for Analytics Queries.
- Since:
- 2.4.3
- Author:
- Michael Nitschinger
- See Also:
- Serialized Form
-
Method Summary
Modifier and Type Method Description static AnalyticsParams
build()
Start building aAnalyticsParams
, allowing to customize an Analytics requests.String
clientContextId()
Helper method to check if a client context ID is set.boolean
deferred()
AnalyticsParams
deferred(boolean deferred)
Set to true for deferred query execution (Translates to mode async for the server request)boolean
equals(Object o)
int
hashCode()
boolean
hasServerSideTimeout()
Helper method to check if a custom server side timeout has been applied on the params.void
injectParams(JsonObject queryJson)
Modifies the given Analytics query (as aJsonObject
) to reflect theseN1qlParams
.AnalyticsParams
pretty(boolean pretty)
If set to false, the server will be instructed to remove extra whitespace from the JSON response in order to save bytes.int
priority()
Returns the set priority as an integer.AnalyticsParams
priority(boolean priority)
If this request should receive priority in server side scheduling.AnalyticsParams
rawParam(String name, Object value)
Allows to specify an arbitrary, raw Analytics param.AnalyticsParams
serverSideTimeout(long timeout, TimeUnit unit)
Sets a maximum timeout for processing on the server side.String
toString()
AnalyticsParams
withContextId(String clientContextId)
Adds a client context ID to the request, that will be sent back in the response, allowing clients to meaningfully trace requests/responses when many are exchanged.
-
Method Details
-
injectParams
Modifies the given Analytics query (as aJsonObject
) to reflect theseN1qlParams
.- Parameters:
queryJson
- the Analytics query
-
withContextId
Adds a client context ID to the request, that will be sent back in the response, allowing clients to meaningfully trace requests/responses when many are exchanged.- Parameters:
clientContextId
- the client context ID (null to send none)- Returns:
- this
AnalyticsParams
for chaining.
-
serverSideTimeout
Sets a maximum timeout for processing on the server side.- Parameters:
timeout
- the duration of the timeout.unit
- the unit of the timeout, from nanoseconds to hours.- Returns:
- this
AnalyticsParams
for chaining.
-
rawParam
Allows to specify an arbitrary, raw Analytics param. Use with care and only provide options that are supported by the server and are not exposed as part of the overall stable API in theAnalyticsParams
class.- Parameters:
name
- the name of the property.value
- the value of the property, only JSON value types are supported.- Returns:
- this
AnalyticsParams
for chaining.
-
pretty
If set to false, the server will be instructed to remove extra whitespace from the JSON response in order to save bytes. In performance-critical environments as well as large responses this is recommended in order to cut down on network traffic. Note that false is the default, since usually that's what is recommended.- Parameters:
pretty
- if set to false, pretty responses are disabled.- Returns:
- this
AnalyticsParams
for chaining.
-
priority
If this request should receive priority in server side scheduling. Default is false.- Parameters:
priority
- true if it should, false otherwise.- Returns:
- this
AnalyticsParams
for chaining.
-
deferred
-
deferred
Set to true for deferred query execution (Translates to mode async for the server request)- Parameters:
deferred
- true for deferred execution, false otherwise.- Returns:
- this
AnalyticsParams
for chaining.
-
priority
Returns the set priority as an integer. This method is considered private API.- Returns:
- the priority if set, 0 if not set.
-
hasServerSideTimeout
public boolean hasServerSideTimeout()Helper method to check if a custom server side timeout has been applied on the params.- Returns:
- true if it has, false otherwise.
-
clientContextId
Helper method to check if a client context ID is set. -
build
Start building aAnalyticsParams
, allowing to customize an Analytics requests.- Returns:
- a new
AnalyticsParams
-
equals
-
hashCode
public int hashCode() -
toString
-