Class IPCInterfaceImpl

java.lang.Object
com.biglybt.pifimpl.local.ipc.IPCInterfaceImpl
All Implemented Interfaces:
IPCInterface

public class IPCInterfaceImpl extends Object implements IPCInterface
  • Field Details

    • target_use_accessor

      private Object target_use_accessor
    • plugin_class

      private String plugin_class
    • plugin_initializer

      private PluginInitializer plugin_initializer
  • Constructor Details

    • IPCInterfaceImpl

      public IPCInterfaceImpl(PluginInitializer _plugin_initializer, Plugin _target)
      Constructor for real plugin based providers. Supports plugin unloading
      Parameters:
      _plugin_initializer -
      _target -
    • IPCInterfaceImpl

      public IPCInterfaceImpl(Object _target)
      Constructor for non-plugin providers
      Parameters:
      _target -
  • Method Details

    • canInvoke

      public boolean canInvoke(String methodName, Object[] params)
      Description copied from interface: IPCInterface
      Test for existance of IPC method - params as above
      Specified by:
      canInvoke in interface IPCInterface
      Parameters:
      methodName -
      params -
      Returns:
    • canInvoke

      public boolean canInvoke(String methodName, Class<?>[] params)
    • invoke

      public Object invoke(String methodName, Object[] params) throws IPCException
      Description copied from interface: IPCInterface
      This function will call the given method on the plugin. This function allows direct method calls to the plugin using Java Reflection API. Primitives like int, boolean need to be wrapped in their Objects (int -> Integer).

      Results will be returned as Object and can be classcasted.

      WARNING: only call Methods that use Java or client Classes the use of custom classes may cause problems.

      Examples:

      1. Plugin has method int add (int x, int y);

       int result = ((Integer)invoke ("add", new Object[] {Integer.valueOf(10),Integer.valueOf(5)}).intValue();
       //result (15)
       
      2. Plugin has method String randomize (String x);
       String result = (String)invoke("randomize", new Object[]{"foobar"});
       //result ("bfaoro")
       
      Specified by:
      invoke in interface IPCInterface
      Parameters:
      methodName - the name of the Methods to be called
      params - Parameters of the Method
      Returns:
      returns the result of the method
      Throws:
      IPCException
    • getMethod

      protected Method getMethod(Object target, String methodName, Object[] params) throws Throwable
      Throws:
      Throwable
    • getMethod

      protected Method getMethod(Object target, String methodName, Class<?>[] paramTypes) throws Throwable
      Throws:
      Throwable
    • getTarget

      protected Object getTarget() throws IPCException
      Throws:
      IPCException
    • unload

      public void unload()