public final class NeovimHandlerManager
extends java.lang.Object
NeovimNotificationHandler
and NeovimRequestHandler
It provides methods to register/unregister any kind of object as neovim handler, but only classes with methods
annotated with NeovimNotificationHandler
or NeovimRequestHandler
can be useful, since this will
find such methods and call them once notifications/requests arrive
To get notifications/requests it should first be attached to a RPCStreamer
using attachToStream(RPCStreamer)
Underneath, NeovimHandlerProxy
is used to dispatch notifications/requests, which delegates thread management to it
Examples:
NeovimHandlerManager neovimHandlerManager = new NeovimHandlerManager();
neovimHandlerManager.registerNeovimHandler(uiEventHandler);
neovimHandlerManager.attachToStream(neovimStream);
Constructor | Description |
---|---|
NeovimHandlerManager() |
|
NeovimHandlerManager(NeovimHandlerProxy neovimHandlerProxy) |
Creates a new
NeovimHandlerManager with given NeovimHandlerProxy |
Modifier and Type | Method | Description |
---|---|---|
void |
attachToStream(com.ensarsarajcic.neovim.java.corerpc.client.RPCStreamer rpcStreamer) |
Attaches to given
RPCStreamer
RPCStreamer does not have to be attached to an actual connection at the time of this call, since this
only sets up the notification/request callbacks |
void |
registerNeovimHandler(java.lang.Object handler) |
Registers a new handler
If this object is already registered, this is a no-op
If this object has methods annotated with
NeovimNotificationHandler or NeovimRequestHandler ,
this method will have no effect, but it will still reflectively look for such methods |
void |
unregisterNeovimHandler(java.lang.Object handler) |
Unregisters passed handler
If it was not registered previously, this is a no-op
It will no longer receive notifications/requests after this point, unless it is registered again
|
public NeovimHandlerManager()
public NeovimHandlerManager(NeovimHandlerProxy neovimHandlerProxy)
NeovimHandlerManager
with given NeovimHandlerProxy
neovimHandlerProxy
- proxy to use for dispatching notifications/messagesjava.lang.NullPointerException
- if passed NeovimHandlerProxy
is nullpublic void attachToStream(com.ensarsarajcic.neovim.java.corerpc.client.RPCStreamer rpcStreamer)
RPCStreamer
RPCStreamer
does not have to be attached to an actual connection at the time of this call, since this
only sets up the notification/request callbacksrpcStreamer
- streamer whose notifications/requests should be analysedjava.lang.NullPointerException
- if RPCStreamer
is nullpublic void registerNeovimHandler(java.lang.Object handler)
NeovimNotificationHandler
or NeovimRequestHandler
,
this method will have no effect, but it will still reflectively look for such methods
This works for both static and instance methods
Passed objects methods are prepared to be called when new notifications/requests arrive from attached RPCStreamer
This may be called prior to attaching, but no notifications/requests can arrive before attaching
handler
- object to search for annotated methodspublic void unregisterNeovimHandler(java.lang.Object handler)
handler
- object to unregisterCopyright © 2018. All rights reserved.