Interface ContainerSubscriptionParameters
- All Superinterfaces:
RecordSubscriptionParameters,SubscriptionParameters
ContainerSubscriptionParameters call the
{@link com.caplin.streamlink.StreamLink.createContainerSubscriptionParameters()} method.-
Method Summary
Modifier and TypeMethodDescriptionAllow aggregation of grouped containers, in addition to selection, sorting and grouping.Allow selection, sorting and grouping of containers.Sets the subscription to keep elements in the container that are inaccessible.Sets the subscription to provide only the container structure (no constituent images or updates).setWindow(int start, int size) Sets the size of the container window.Methods inherited from interface com.caplin.streamlink.RecordSubscriptionParameters
setFields, setFilter
-
Method Details
-
setWindow
Sets the size of the container window.- Parameters:
start- The index of the first container element within the window, where the first container element has an index value of 0 (zero).size- The maximum number of container elements within the window.- Returns:
- The update
ContainerSubscriptionParametersobject to permit a fluent programming style.
-
setStructureOnly
ContainerSubscriptionParameters setStructureOnly()Sets the subscription to provide only the container structure (no constituent images or updates).- Returns:
- The update
ContainerSubscriptionParametersobject to permit a fluent programming style.
-
setKeepInaccessible
ContainerSubscriptionParameters setKeepInaccessible()Sets the subscription to keep elements in the container that are inaccessible.- Returns:
- The update
ContainerSubscriptionParametersobject to permit a fluent programming style.
-
select
Allow selection, sorting and grouping of containers.Example: params.select('bid>123&ask<122', "bid ASC NUMBER, ask DESC NUMBER", "bid" )
The static
ContainerFilterFactorycan be used to build aFilterExpressionwhosetoFilterStringmethod will generate a where clause in the required format.Note: this method will only work if the backend has the Caplin Refiner installed.
The following example shows how to build an expression for FIELD1 > 0.1 AND FIELD3 = "a a"
ContainerSubscriptionParameters containerSubscriptionParameters = streamLink.createContainerSubscriptionParameters(); FilterExpression exp1 = ContainerFilterFactory.create("FIELD1", FilterExpressionOperator.GREATER_THAN, "0.1"); FilterExpression exp2 = ContainerFilterFactory.create("FIELD3", FilterExpressionOperator.EQUAL, "a a"); FilterExpression exp1Andexp2 = ContainerFilterFactory.createLogical(FilterExpressionLogicalOperator.AND, exp1, exp2); containerSubscriptionParameters.select(exp1Andexp2.toFilterString(), "FIELD1", null); Subscription subscription = streamlink.subscribe("/container", subscriptionListener, containerSubscriptionParameters);- Parameters:
where- The where clause, in the form required by Caplin Refiner (example 'bid>123&ask<222').orderBy- The sorting order of the returned container in the form: field [ASC or DESC] [NUMBER or TEXT], ... example: bid DESC NUMBER,ask ASC NUMBERgroupBy- The group by clause in the form: field example: bid- Returns:
- The update
ContainerSubscriptionParametersobject to permit a fluent programming style.
-
aggregate
ContainerSubscriptionParameters aggregate(String aggregateFields, String where, String groupBy, String orderBy, String having) Allow aggregation of grouped containers, in addition to selection, sorting and grouping.This behaves like
select(String, String, String)but additionally groups the container by one or more fields and computes aggregate values (for example a sum or count) over each group. An optionalhavingclause filters the resulting aggregated rows.Example: params.aggregate("SUM contract_rate contract_sum, COUNT contract_rate count", "primary_ccy==GBP", "buy_sell,primary_ccy", "contract_sum DESC NUMBER", "number:contract_sum>123")
The static
ContainerFilterFactorycan be used to build aFilterExpressionwhosetoFilterStringmethod will generate a where or having clause in the required format.Note: this method will only work if the backend has the Caplin Refiner installed.
- Parameters:
aggregateFields- The aggregate clause, a comma separated list of "function field alias" tuples, wherefunctionis the aggregation to apply (SUM, MEAN or COUNT),fieldis the field to aggregate (using * if the function is COUNT) andaliasis the name given to the aggregated result. Example: "SUM contract_rate contract_sum, COUNT * count".where- The where clause, in the form required by Caplin Refiner (example 'bid>123&ask<222').groupBy- The group by clause, a comma separated list of fields to group by, in the form: field [,field] example: buy_sell,primary_ccyorderBy- The sorting order of the returned container in the form: field [ASC or DESC] [NUMBER or TEXT], ... example: contract_sum DESC NUMBERhaving- The having clause applied to the aggregated results, in the form required by Caplin Refiner (example 'number:contract_sum>123').- Returns:
- The update
ContainerSubscriptionParametersobject to permit a fluent programming style.
-