org.atmosphere.wasync
Interface Function<T>

Type Parameters:
T -

public interface Function<T>

A function is asynchronously invoked when a response is received, complete or not.

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>() { .... }

Author:
Jeanfrancois Arcand

Method Summary
 void on(T t)
          A function that will be invoked when a object of type T is defined.
 

Method Detail

on

void on(T t)
A function that will be invoked when a object of type T is defined.

Parameters:
t - A function that will be invoked when a object of type T is defined.


Copyright © 2013. All Rights Reserved.