public final class PluginEvent
extends java.lang.Object
ObservablePlugin
.
A PluginEvent.EventType.READER_CONNECTED
event is fired if a new reader is detected and a PluginEvent.EventType.READER_DISCONNECTED
event is fired when an already registered reader is removed from
the system.
The getReaderNames()
and getEventType()
methods allow the event recipient to
retrieve the names of the readers involved and the type of the event.
There are two types of events, the connection and disconnection of readers.
Since the event provides a list of reader names, a single event can be used to notify a change for one or more readers.
However, only one type of event is notified at a time.
Modifier and Type | Class and Description |
---|---|
static class |
PluginEvent.EventType
The two types of reader event
|
Constructor and Description |
---|
PluginEvent(java.lang.String pluginName,
java.util.Set<java.lang.String> readerNames,
PluginEvent.EventType eventType)
Create a PluginEvent for multiple readers from the plugin name, multiple reader names and the
type of event.
|
PluginEvent(java.lang.String pluginName,
java.lang.String readerName,
PluginEvent.EventType eventType)
Create a PluginEvent for a single reader from the plugin and reader names and the type of
event.
|
Modifier and Type | Method and Description |
---|---|
PluginEvent.EventType |
getEventType()
Gets the plugin event type.
|
java.lang.String |
getPluginName()
Gets the name of the plugin to which the reader that generated the event belongs.
|
java.util.SortedSet<java.lang.String> |
getReaderNames()
Gets the names of the readers related to the event in the form of a sorted set.
|
public PluginEvent(java.lang.String pluginName, java.lang.String readerName, PluginEvent.EventType eventType)
pluginName
- A string containing the name of the plugin (should be not null).readerName
- A string containing the name of the reader (should be not null).eventType
- An event type PluginEvent.EventType.READER_CONNECTED
or PluginEvent.EventType.READER_DISCONNECTED
(should be not null).public PluginEvent(java.lang.String pluginName, java.util.Set<java.lang.String> readerNames, PluginEvent.EventType eventType)
Note: gathering several readers in the same event is always done for a same type of event (e.g. simultaneous disconnection of 2 readers).
pluginName
- A string containing the name of the plugin (must be not empty).readerNames
- A set of string containing the reader names (must be not empty).eventType
- An event type PluginEvent.EventType.READER_CONNECTED
or PluginEvent.EventType.READER_DISCONNECTED
(must be not null).public java.lang.String getPluginName()
public java.util.SortedSet<java.lang.String> getReaderNames()
public PluginEvent.EventType getEventType()