E - the type of events.public class DXFeedTimeSeriesSubscription<E extends TimeSeriesEvent> extends DXFeedSubscription<E>
DXFeedSubscription to conveniently subscribe to time-series of
events for a set of symbols and event types. This class decorates symbols
that are passed to xxxSymbols methods in DXFeedSubscription
by wrapping them into TimeSeriesSubscriptionSymbol instances with
the current value of fromTime property.
While getSymbols method returns original (undecorated)
symbols, any installed ObservableSubscriptionChangeListener will see
decorated ones.
Only events that implement TimeSeriesEvent interface can be
subscribed to with DXFeedTimeSeriesSubscription.
fromTime property defines the time-span of
events that are subscribed to. Only events that satisfy
event.getEventTime() >= thisSubscription.getFromTime() are looked for.
The value fromTime is initially set to Long.MAX_VALUE
with a special meaning that no events will be received until fromTime is
changed with setFromTime method.
| Constructor and Description |
|---|
DXFeedTimeSeriesSubscription(Class<? extends E>... eventTypes)
Creates detached time-series subscription for the given list of event types.
|
DXFeedTimeSeriesSubscription(Class<? extends E> eventType)
Creates detached time-series subscription for a single event type.
|
| Modifier and Type | Method and Description |
|---|---|
protected Object |
decorateSymbol(Object symbol)
Decorates the specified symbol after it was received from the
DXFeedSubscription client code
before it goes to installed ObservableSubscriptionChangeListener instances. |
long |
getFromTime()
Returns the earliest timestamp from which time-series of events shall be received.
|
void |
setFromTime(long fromTime)
Sets the earliest timestamp from which time-series of events shall be received.
|
protected Object |
undecorateSymbol(Object symbol)
Undoes the decoration of the specified symbol doing the reverse operation to
decorateSymbol(Object). |
addChangeListener, addEventListener, addSymbols, addSymbols, addSymbols, attach, clear, close, containsEventType, detach, getDecoratedSymbols, getEventTypes, getExecutor, getSymbols, isClosed, removeChangeListener, removeEventListener, removeSymbols, removeSymbols, setExecutor, setSymbols, setSymbols, shallNotifyOnSymbolUpdatepublic DXFeedTimeSeriesSubscription(Class<? extends E> eventType)
eventType - the event type.NullPointerException - if event type is null.public DXFeedTimeSeriesSubscription(Class<? extends E>... eventTypes)
eventTypes - the list of event types.IllegalArgumentException - if the list of event types is empty.NullPointerException - if any event type is null.public long getFromTime()
System.currentTimeMillis()public void setFromTime(long fromTime)
fromTime - the timestamp.System.currentTimeMillis()protected Object decorateSymbol(Object symbol)
DXFeedSubscription client code
before it goes to installed ObservableSubscriptionChangeListener instances.
This implementation wraps symbol into TimeSeriesSubscriptionSymbol with a current
fromTime value.decorateSymbol in class DXFeedSubscription<E extends TimeSeriesEvent>symbol - the symbol to decorate.NullPointerException - if symbol is null.protected Object undecorateSymbol(Object symbol)
decorateSymbol(Object).
This implementation throws ClassCastException is symbol is not an instance of
TimeSeriesSubscriptionSymbol or returns its
eventSymbol otherwise.undecorateSymbol in class DXFeedSubscription<E extends TimeSeriesEvent>symbol - the symbol to undecorate.TimeSeriesSubscriptionSymbol.NullPointerException - if symbol is null.Copyright © 2002–2023 Devexperts LLC. All rights reserved.