org.atmosphere.wasync
Interface Decoder<U,T>
- Type Parameters:
U - T -
- All Known Subinterfaces:
- ReplayDecoder
- All Known Implementing Classes:
- TrackMessageSizeDecoder
public interface Decoder<U,T>
A decoder can be used to 'decode' the response's body. Decoder can be chained amongst themselves in order to create
plain Java Object. Decoder's can be used to decode the response body and match them with Function's implementation.
This library will try to match the decoded Object to its associated Function. For example, the Decoder's type will
be mapped, by the FunctionResolver to the Function of the same type if no function message has been defined:
Decoder<String, POJO> d = new Decoder<String, POJO>() {
@Override
public POJO decode(Transport.EVENT_TYPE e, String s) {
return new POJO(s);
}
}
Function<POJO> f = new Function<POJO>() {
@Override
public void on(Transport.EVENT_TYPE e, POJO t) {
}
}
- Author:
- Jeanfrancois Arcand
decode
T decode(Transport.EVENT_TYPE e,
U s)
- Decode the specified object of type U into object of type T
- Parameters:
e - Transport.EVENT_TYPEs - a object of type U
- Returns:
- a new object of type T
Copyright © 2013. All Rights Reserved.