handleEvent
Object handleEvent ( EventFireTime fireTime, AbstractEventData data )
Description
Processes the event, and potentially returns a useful value modifying something in the internal code as defined by the EventFireTime used to launch this event.
Parameters
- fireTime Defines the methods that a fire time must have.
- data Allows for the accessing of various data values found within ScreenScraper dependent on the class used.
Return Values
Returns a value based on which AbstractEventData class is used.
Change Log
Version | Description |
---|---|
6.0.55a | Available for all editions. |
EventHandler handler = new EventHandler()
{
public String getHandlerName()
{
// return something
}
/**
* Processes the event, and potentially returns a useful value modifying something
* in the internal code
*
* @param fireTime The fire time of the event. This helps when using the same handler
* for multiple event times, to determine which was called
* @param data The actual data from the event. Based on the event time this
* will be a different type. It could be SessionEventData, ScrapeableFileEventData,
* ScriptEventData, StringEventData, etc... It will match the fire time class name
*
* @return A value indicating how to proceed (or sometimes the value is ignored)
*/
public Object handleEvent(EventFireTime fireTime, AbstractEventData data)
{
// While you can specifically grab any data from the data object,
// if this is a method that has a return value that matters,
// it's best to get it as the last return value, so that multiple
// events can be chained together. The input data object
// will always have the original values for all the other getters
Object returnValue = data.getLastReturnValue();
// Do stuff...
// The EventFireTime values describe in the documentation what the return
// value will do, or says nothing about it if the value is ignored
// If you don't intend to modify the return, always return data.getLastReturnValue();
return returnValue;
}
};
{
public String getHandlerName()
{
// return something
}
/**
* Processes the event, and potentially returns a useful value modifying something
* in the internal code
*
* @param fireTime The fire time of the event. This helps when using the same handler
* for multiple event times, to determine which was called
* @param data The actual data from the event. Based on the event time this
* will be a different type. It could be SessionEventData, ScrapeableFileEventData,
* ScriptEventData, StringEventData, etc... It will match the fire time class name
*
* @return A value indicating how to proceed (or sometimes the value is ignored)
*/
public Object handleEvent(EventFireTime fireTime, AbstractEventData data)
{
// While you can specifically grab any data from the data object,
// if this is a method that has a return value that matters,
// it's best to get it as the last return value, so that multiple
// events can be chained together. The input data object
// will always have the original values for all the other getters
Object returnValue = data.getLastReturnValue();
// Do stuff...
// The EventFireTime values describe in the documentation what the return
// value will do, or says nothing about it if the value is ignored
// If you don't intend to modify the return, always return data.getLastReturnValue();
return returnValue;
}
};
See Also
samt on 03/10/2016 at 4:02 pm
- Printer-friendly version
- Login or register to post comments