java.lang.Object
com.ensarsarajcic.neovim.java.handler.NeovimHandlerManager

public final class NeovimHandlerManager extends Object
Simple class used to register and connect 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 Details

  • Method Details

    • attachToStream

      public void attachToStream(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
      Parameters:
      rpcStreamer - streamer whose notifications/requests should be analysed
      Throws:
      NullPointerException - if RpcStreamer is null
    • registerNeovimHandler

      public void registerNeovimHandler(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

      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

      Parameters:
      handler - object to search for annotated methods
    • unregisterNeovimHandler

      public void unregisterNeovimHandler(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
      Parameters:
      handler - object to unregister