Class PluginParameterBinding

  • All Implemented Interfaces:
    java.lang.Comparable<PluginParameterBinding>

    public class PluginParameterBinding
    extends java.lang.Object
    implements java.lang.Comparable<PluginParameterBinding>
    This class represents a binding between a method of a plugin and a set of parameters. The semantics of this object are as follows. First, the PluginParameterBinding.Factory.tryToBind() should be used to construct a list of PluginParameterBindings. This method is called with a variable array of parameter types, such that for each returned binding, the invoke() method can be called with a variable array of instantiations of these types, in that order. Any reordering that needs to be done (if tryToBind() was called with orderedParameters == false) is handled by the binding. A PluginParameterBinding is only guaranteed to be executable, if the factory method was called with mustBeTotal set to true.
    Author:
    bfvdonge
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  PluginParameterBinding.Factory
      Factory for instantiating PluginParameterBindings binding plugins with a given input.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(PluginParameterBinding other)  
      boolean equals​(java.lang.Object o)
      Equality of bindings is based on the binding, plugin and complete status.
      int[] getBinding()
      This method returns an array of integers, of which the length corresponds to the length of the list of parameters types provided to the PluginParameterBinding factory.
      int getMethodIndex()
      Returns the method index of the method which is bound by this binding.
      PluginDescriptor getPlugin()
      Returns the Plugin which is bound by this binding.
      int hashCode()
      Returns a hashcode based on the binding, plugin and complete status
      PluginExecutionResult invoke​(PluginContext context, java.lang.Object... parameterObjects)
      Invokes the method of the plugin referenced by this binding on the given parameterObjects.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • invoke

        public PluginExecutionResult invoke​(PluginContext context,
                                            java.lang.Object... parameterObjects)
        Invokes the method of the plugin referenced by this binding on the given parameterObjects. It should be noted that the number of given parameter object should be the same as the number of parameter types provided to the tryToBind() method of the factory. Furthermore, the types of these parameters should be right, i.e. each object should be of the right type, or should be a ProMFuture on that type. In this method, the given parameters are first re-ordered according to the given binding and then getPlugin().invoke(getMethodIndex(), context, ...) is called, on the newly ordered parameters. No checks are done if this plugin is executable or not on the given input, it's up to the plugin to handle this
        Parameters:
        context - Note that the plugin should be executable in this context. However, since PluginContext's should be kept uniformly typed within one instance of ProM, no checks are done here.
        parameterObjects -
        Returns:
      • getPlugin

        public PluginDescriptor getPlugin()
        Returns the Plugin which is bound by this binding.
        Returns:
      • getBinding

        public int[] getBinding()
        This method returns an array of integers, of which the length corresponds to the length of the list of parameters types provided to the PluginParameterBinding factory. For each parameter type, this array indicates to which parameter of the plugin it is bound. For each element x of this array is holds that 0 <= x < getPlugin().getParameterNames(getMethodIndex()) If the same parameter index is provided for different parameters (i.e. getBinding()[x] == getBinding()[y] with x != y, then this impliest that the parameter is an array type, to which multiple objects can be connected. In other words, this implies that getPlugin().getParameterType(getMethodIndex(),getBinding()[x]).isArray() == true
        Returns:
      • equals

        public boolean equals​(java.lang.Object o)
        Equality of bindings is based on the binding, plugin and complete status.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Returns a hashcode based on the binding, plugin and complete status
        Overrides:
        hashCode in class java.lang.Object
      • getMethodIndex

        public int getMethodIndex()
        Returns the method index of the method which is bound by this binding. When this binding is invoked, this method inside the plugin provided by getPlugin() is invoked.
        Returns: