com.esotericsoftware.kryonet
Class Listener.ReflectionListener

java.lang.Object
  extended by com.esotericsoftware.kryonet.Listener
      extended by com.esotericsoftware.kryonet.Listener.ReflectionListener
Enclosing class:
Listener

public static class Listener.ReflectionListener
extends Listener

Uses reflection to called "received(Connection, XXX)" on the listener, where XXX is the received object type. Note this class uses a HashMap lookup and (cached) reflection, so is not as efficient as writing a series of "instanceof" statements.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.esotericsoftware.kryonet.Listener
Listener.LagListener, Listener.QueuedListener, Listener.ReflectionListener, Listener.ThreadedListener
 
Constructor Summary
Listener.ReflectionListener()
           
 
Method Summary
 void received(Connection connection, java.lang.Object object)
          Called when an object has been received from the remote end of the connection.
 
Methods inherited from class com.esotericsoftware.kryonet.Listener
connected, disconnected
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Listener.ReflectionListener

public Listener.ReflectionListener()
Method Detail

received

public void received(Connection connection,
                     java.lang.Object object)
Description copied from class: Listener
Called when an object has been received from the remote end of the connection. This will be invoked on the same thread as Client.update(int) and Server.update(int). This method should not block for long periods as other network activity will not be processed until it returns.

Overrides:
received in class Listener