org.atmosphere.wasync
Interface Decoder<U,T>

Type Parameters:
U -
T -

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(String s) {
                 return new POJO(s);
             }
         }

   Function<POJO> f = new Function<POJO>() {
             @Override
             public void on(POJO t) {

             }
        }

 

Author:
Jeanfrancois Arcand

Method Summary
 T decode(U s)
          Decode the specified object of type U into object of type T
 

Method Detail

decode

T decode(U s)
Decode the specified object of type U into object of type T

Parameters:
s - a object of type U
Returns:
a new object of type T


Copyright © 2012. All Rights Reserved.