Package org.elypia.webhooker
Class DispatcherSupplier
- java.lang.Object
-
- org.elypia.webhooker.DispatcherSupplier
-
public class DispatcherSupplier extends Object
This is a means to manage and supply dispatchers to yourClientControllerthat serialize or deseralize the client instances. This is not required by all ClientControllers.
-
-
Constructor Summary
Constructors Constructor Description DispatcherSupplier()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(String id, Supplier<Dispatcher> supplier)Add a dispatcher to map serialized clients dispatchers to.voidadd(Dispatcher dispatcher)Add a singleton dispatcher, this will not instantiate a new dispatcher when required but reuse the same one throughout the application lifetime.Dispatcherget(String id)Get an instance of a Dispatcher of which it's supplier was added.
-
-
-
Method Detail
-
add
public void add(Dispatcher dispatcher)
Add a singleton dispatcher, this will not instantiate a new dispatcher when required but reuse the same one throughout the application lifetime.- Parameters:
dispatcher- The dispatcher to add.
-
add
public void add(String id, Supplier<Dispatcher> supplier)
Add a dispatcher to map serialized clients dispatchers to. This will be used when serializing a client to obtain the actual dispatcher.- Parameters:
id- The ID of the dispatcher, the serialized client should store this.supplier- How to create an instance of this dispatcher.
-
get
public Dispatcher get(String id)
Get an instance of a Dispatcher of which it's supplier was added.- Parameters:
id- The ID of the dispatcher.- Returns:
- An instantiated dispatcher instance.
-
-