-
Notifications
You must be signed in to change notification settings - Fork 2
Listeners
One may create their own CrawlerListener
to listen to the events generated from the Crawler
in its operation. Each event has a void handler method which is called from the Crawler
, with its CrawlerListener
instance.
Please refer to the CrawlerListener
class to see the possible events, and the Crawler
classes to see when they're triggered. Additional information is given as a comment on each of the events in the CrawlerListener
class.
Simply implement the CrawlerListener
interface. Then, when constructing a Crawler
, pass your CrawlerListener
into its constructor to use it.
One may simply implement all the event methods from the CrawlerListener
class for their own CrawlerListener
.
If one seeks to only extend the DefaultCrawlerListener
, e.g for adding additional functionality ontop of the default functionality, then this may be done for a single handler as follows:
public class ExampleCrawlerListener extends DefaultCrawlerListener {
@Override
public void onCrawlSummoner(Summoner summoner) {
super.onCrawlSummoner(summoner);
// additional functionality goes here...
}
}
There is a single preset CrawlerListener
: the DefaultCrawlerListener
, which simply prints to System.out relevant information regarding each event. This can be located in presets/listeners
.