Package com.bloomberglp.blpapi
Class SubscriptionList
java.lang.Object
com.bloomberglp.blpapi.SubscriptionList
- All Implemented Interfaces:
Iterable<Subscription>
Contains a list of subscriptions.
This component provides a structure to hold the data used (and returned) by the Session.subscribe(com.bloomberglp.blpapi.SubscriptionList)
, Session.resubscribe(com.bloomberglp.blpapi.SubscriptionList)
, and Session.unsubscribe(com.bloomberglp.blpapi.SubscriptionList)
methods.
See "STRUCTURE OF SUBSCRIPTION STRING" section in Subscription
for more information on
subscription strings.*
QUALIFYING SUBSCRIPTION STRINGS
The subscription strings passed toSubscription
are automatically qualified if the
service identifier is missing (i.e. if the subscription string does not start with "//"). The
subscription parameters (i.e. the optional part after instrument identifier) are never modified.
The rules for qualifying the subscription string are:
- If the subscription string begins with "//" then it is assumed to be a a fully qualified subscription string including service identifier, prefix, and instrument. In this case the string will not be modified and session options defaults have no affect on the subscription.
- If the subscription string begins with a '/' and the second character is not '/', then the
string is assumed to begin with the topic prefix, but no service identifier. In this case
the string is qualified by prepending the
SessionOptions.getDefaultSubscriptionService()
to the specified string. - If the subscription string does not begin with a '/' it is assumed to begin with an
instrument identifier. In this case the string is qualified by prepending the
SessionOptions.getDefaultSubscriptionService()
followed bySessionOptions.getDefaultTopicPrefix()
to the specified string. If the 'defaultTopicPrefix' is empty or null, then the prefix used is '/'. Otherwise (in the case of a nontrivial prefix) if the separator '/' is not specified at the beginning or the end of the 'defaultTopicPrefix', then it will be added.
-
Constructor Summary
ConstructorDescriptionConstructs an empty SubscriptionListSubscriptionList
(int initialCapacity) Constructs an empty SubscriptionList with the specified initialCapacity -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(Subscription subscription) Appends the specified subscription to the end of this listvoid
clear()
Remove all Subscriptions from this SubscriptionList.get
(int index) Get the Subscription at the specified index in this SubscriptionListboolean
isEmpty()
Tests if this SubscriptionList has no elementsiterator()
Return an iterator over the subscriptions contained in this SubscriptionListremove
(int index) Remove the Subscription at the specified index in this SubscriptionListint
size()
Returns the number of Subscriptions in this SubscriptionListtoArray()
Returns an array containing all of the Subscriptions in this SubscriptionList in the correct orderMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SubscriptionList
public SubscriptionList()Constructs an empty SubscriptionList -
SubscriptionList
public SubscriptionList(int initialCapacity) Constructs an empty SubscriptionList with the specified initialCapacity
-
-
Method Details
-
add
Appends the specified subscription to the end of this list- Parameters:
subscription
- the Subscription that is to be added to this list
-
clear
public void clear()Remove all Subscriptions from this SubscriptionList. -
get
Get the Subscription at the specified index in this SubscriptionList- Parameters:
index
- the index of the Subscription to return- Returns:
- the subscription at the specified index in this SubscriptionList
- Throws:
IndexOutOfBoundsException
- ifindex >= size()
-
isEmpty
public boolean isEmpty()Tests if this SubscriptionList has no elements- Returns:
- true if this SubscriptionList has no elements false otherwise
-
remove
Remove the Subscription at the specified index in this SubscriptionList- Parameters:
index
- the index of the Subscription to remove from this SubscriptionList- Returns:
- the Subscription that was removed from this SubscriptionList
- Throws:
IndexOutOfBoundsException
- ifindex >= size()
-
size
public int size()Returns the number of Subscriptions in this SubscriptionList -
toArray
Returns an array containing all of the Subscriptions in this SubscriptionList in the correct order -
iterator
Return an iterator over the subscriptions contained in this SubscriptionList- Specified by:
iterator
in interfaceIterable<Subscription>
-