|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.tdk.sampleapi.StockInfoManager
StockInfoManager is an entry point to the Sample API.
Its getStock
method is used to create a
StockSymbol
object which in turn can be used to
retrieve a quote.
Stock information is retrieved using the quote agents.
Quote agents can be added to (addQuoteAgent
), removed
(removeQuoteAgent
) and retrieved
(getQuoteAgents
) from the manager.
This class also contains pair of static methods to deal with
the default StockInfoManager (setDefault
,
getDefault
)
Constructor Summary | |
StockInfoManager()
Default constructor. |
Method Summary | |
void |
addQuoteAgent(QuoteAgent agent)
Adds a QuoteAgent to the StockInfoManager lookup table. |
static StockInfoManager |
getDefault()
Gets the default StockInfoManager. |
java.util.Enumeration |
getQuoteAgents()
Gets an enumeration of all installed QuoteAgent s
in the same order they were added to the StockInfoManager. |
StockSymbol |
getStock(java.lang.String symbol)
Creates a StockSymbol object for the specified symbol. |
void |
removeQuoteAgent(QuoteAgent agent)
Removes a QuoteAgent from the StockInfoManager lookup table. |
static void |
setDefault(StockInfoManager newDefault)
Sets the default StockInfoManager. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StockInfoManager()
Method Detail |
public static StockInfoManager getDefault()
StockInfoManager
object that represents the default
value (may be null
)setDefault(com.sun.tdk.sampleapi.StockInfoManager)
public static void setDefault(StockInfoManager newDefault)
newDefault
is
null
there is no default StockInfoManager.
newDefault
- A StockInfoManager
object that specifies the
default valuegetDefault()
public void addQuoteAgent(QuoteAgent agent)
QuoteAgent
to the StockInfoManager lookup table.
If the StockInfoManager lookup table contains a QuoteAgent
passed,
calling this method has no effect.
agent
- A QuoteAgent
object
java.lang.NullPointerException
- if the specified agent is null
public void removeQuoteAgent(QuoteAgent agent)
QuoteAgent
from the StockInfoManager lookup table.
If the StockInfoManager lookup table does not contain QuoteAgent
passed, calling this method has no effect.
agent
- A QuoteAgent
object
java.lang.NullPointerException
- if the specified agent is null
public java.util.Enumeration getQuoteAgents()
QuoteAgent
s
in the same order they were added to the StockInfoManager.
QuoteAgent
spublic StockSymbol getStock(java.lang.String symbol)
GetQuoteException
, it is ignored.
symbol
- A String
null
if the symbol cannot be not found or no agents are installed
java.lang.NullPointerException
- if the specified agent is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |