T - public interface Function<T>
This library supports predefined life cycle's events (@link Event} that can be used. For example, a Function can be defined for handling IOException:
class Function<IOException>() {
public void on(IOEXception ex) {
}
}
This function can be registered using the Socket.on(Function) as
socket.on(new Function<IOEXception>() {
....
}
This is the equivalent of doing
socket.on(Event.ERROR, new Function<IOEXception>() {
....
}
Anonymous functions call also be invoked if a Decoder match its type
socket.decoder(new Decoder<String, POJO>(){
@Override
public POJO decode(Event e, String message) {
return new POJO(message);
}
}
.on(new Function<POJO>() {
....
}
| Modifier and Type | Method and Description |
|---|---|
void |
on(T t)
A function that will be invoked when a object of type T is defined.
|
void on(T t)
t - A function that will be invoked when a object of type T is defined.Copyright © 2019. All Rights Reserved.