public interface ContainerSubscriptionParameters extends RecordSubscriptionParameters
Defines the parameters used for Container subscriptions. To create an instance of
ContainerSubscriptionParameters
call the
com.caplin.streamlink.StreamLink.createContainerSubscriptionParameters()
method.
Modifier and Type | Method and Description |
---|---|
ContainerSubscriptionParameters |
select(java.lang.String where,
java.lang.String orderBy,
java.lang.String groupBy)
Allow selection, sorting and grouping of containers.
|
ContainerSubscriptionParameters |
setWindow(int start,
int size)
Sets the size of the container window.
|
setFields, setFilter
ContainerSubscriptionParameters setWindow(int start, int size)
Sets the size of the container window.
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.ContainerSubscriptionParameters
object to permit a fluent programming style.ContainerSubscriptionParameters select(java.lang.String where, java.lang.String orderBy, java.lang.String groupBy)
Allow selection, sorting and grouping of containers.
Example: params.select('bid>123&ask<122', "bid ASC NUMBER, ask DESC NUMBER", "bid" )
The static ContainerFilterFactory
can be used to build a FilterExpression
whose toFilterString
method 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);
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: bidContainerSubscriptionParameters
object to permit a fluent programming style.Please send bug reports and comments to Caplin support