com.oanda.fxtrade.api
Class FXAccountEvent

java.lang.Object
  extended by com.oanda.fxtrade.api.FXEvent
      extended by com.oanda.fxtrade.api.FXAccountEvent

public abstract class FXAccountEvent
extends FXEvent

The FXAccountEvent class is the abstract superclass of all events which will be fired in response to a new transaction done on an account. An FXAccountEvent can filter incoming transactions by setting a key corresponding to a desired transaction's getType() value. If a key is set, the match method will only be called for transactions with the given type.

Author:
Chris MacGregor

Constructor Summary
FXAccountEvent()
          Default constructor.
FXAccountEvent(boolean b)
          Constructor to set the transient flag.
FXAccountEvent(java.lang.String s)
          Constructor to set the key.
FXAccountEvent(java.lang.String s, boolean b)
          Constructor to set the key and transient flag.
 
Method Summary
 FXEventKey getKey()
          Accessor method used by the API.
abstract  void handle(FXEventInfo EI, FXEventManager EM)
          The handle method is called once for each FXEventInfo which results in the match method returning true.
 boolean match(FXEventInfo EI)
          The match method is used to determine whether the handle method of this event should be called for the given FXEventInfo.
 
Methods inherited from class com.oanda.fxtrade.api.FXEvent
isTransient, setTransient
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FXAccountEvent

public FXAccountEvent()
Default constructor. Sets key to null and transient flag to false.


FXAccountEvent

public FXAccountEvent(java.lang.String s)
Constructor to set the key. Sets transient flag to false.

Parameters:
s - A string corresponding to the type of transaction to filter for (as returned by Transaction.getType()

FXAccountEvent

public FXAccountEvent(boolean b)
Constructor to set the transient flag. Sets key to null.

Parameters:
b - The value to set the transient flag to

FXAccountEvent

public FXAccountEvent(java.lang.String s,
                      boolean b)
Constructor to set the key and transient flag.

Parameters:
s - A string corresponding to the type of transaction to filter for (as returned by Transaction.getType()
b - The value to set the transient flag to
Method Detail

handle

public abstract void handle(FXEventInfo EI,
                            FXEventManager EM)
The handle method is called once for each FXEventInfo which results in the match method returning true. Users must override this method to specify what they want their programs to do when a relevant transaction occurrs.

Specified by:
handle in class FXEvent
Parameters:
EI - The event info which fired this event
EM - The event manager which contains this event

match

public boolean match(FXEventInfo EI)
The match method is used to determine whether the handle method of this event should be called for the given FXEventInfo. The default behaviour of match (if the user doesn't override it) is to return true if the event info's transaction's description matches the one specified on startup.

Specified by:
match in class FXEvent
Parameters:
EI - The FXEventInfo which is being matched
Returns:
True if the handle method should be called for the given FXEventInfo, false otherwise

getKey

public final FXEventKey getKey()
Accessor method used by the API.

Specified by:
getKey in class FXEvent
Returns:
The FXEventKey used to match this FXEvent to an FXEventInfo


Copyright © 2005 OANDA Corporation. All Rights Reserved.