public interface Listenable<T_Listener>
Listenable
defines an interface for objects that can have listeners for listening their
events. A concrete implementation of Listenable
can be annotated using
Listenable.Singled
annotation to allow only one listener.Modifier and Type | Interface and Description |
---|---|
static interface |
Listenable.Singled |
Modifier and Type | Method and Description |
---|---|
boolean |
addListener(T_Listener listener) |
int |
getListenerCount() |
java.util.List<T_Listener> |
getListeners() |
T_Listener |
getSingleListener()
Return a single listener if there is only one listener.
|
boolean |
hasAnyListeners() |
boolean |
isSingled()
Test if this
Listenable is annotated with Listenable.Singled to indicate that this
Listenable is allowed to have at most a single listener. |
void |
removeAllListeners() |
boolean |
removeListener(T_Listener listener) |
T_Listener getSingleListener()
IllegalStateException
java.util.List<T_Listener> getListeners()
int getListenerCount()
boolean addListener(T_Listener listener)
boolean removeListener(T_Listener listener)
void removeAllListeners()
boolean hasAnyListeners()
boolean isSingled()
Listenable
is annotated with Listenable.Singled
to indicate that this
Listenable
is allowed to have at most a single listener.boolean
value.