Class SubscriptionList

java.lang.Object
com.bloomberglp.blpapi.SubscriptionList
All Implemented Interfaces:
Iterable<Subscription>

public final class SubscriptionList extends Object implements 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 to Subscription 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 by SessionOptions.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

    Constructors
    Constructor
    Description
    Constructs an empty SubscriptionList
    SubscriptionList(int initialCapacity)
    Constructs an empty SubscriptionList with the specified initialCapacity
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(Subscription subscription)
    Appends the specified subscription to the end of this list
    void
    Remove all Subscriptions from this SubscriptionList.
    get(int index)
    Get the Subscription at the specified index in this SubscriptionList
    boolean
    Tests if this SubscriptionList has no elements
    Return an iterator over the subscriptions contained in this SubscriptionList
    remove(int index)
    Remove the Subscription at the specified index in this SubscriptionList
    int
    Returns the number of Subscriptions in this SubscriptionList
    Returns an array containing all of the Subscriptions in this SubscriptionList in the correct order

    Methods 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

      public boolean add(Subscription subscription)
      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

      public Subscription get(int index)
      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 - if index >= size()
    • isEmpty

      public boolean isEmpty()
      Tests if this SubscriptionList has no elements
      Returns:
      true if this SubscriptionList has no elements false otherwise
    • remove

      public Subscription remove(int index)
      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 - if index >= size()
    • size

      public int size()
      Returns the number of Subscriptions in this SubscriptionList
    • toArray

      public Subscription[] toArray()
      Returns an array containing all of the Subscriptions in this SubscriptionList in the correct order
    • iterator

      public Iterator<Subscription> iterator()
      Return an iterator over the subscriptions contained in this SubscriptionList
      Specified by:
      iterator in interface Iterable<Subscription>