Class PluginParameterBinding
- java.lang.Object
-
- org.processmining.framework.plugin.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, thePluginParameterBinding.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, theinvoke()
method can be called with a variable array of instantiations of these types, in that order. Any reordering that needs to be done (iftryToBind()
was called withorderedParameters == false
) is handled by the binding. A PluginParameterBinding is only guaranteed to be executable, if the factory method was called withmustBeTotal
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 statusPluginExecutionResult
invoke(PluginContext context, java.lang.Object... parameterObjects)
Invokes the method of the plugin referenced by this binding on the given parameterObjects.
-
-
-
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 thetryToBind()
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 aProMFuture
on that type. In this method, the given parameters are first re-ordered according to the given binding and thengetPlugin().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 elementx
of this array is holds that0 <= x < getPlugin().getParameterNames(getMethodIndex())
If the same parameter index is provided for different parameters (i.e.getBinding()[x] == getBinding()[y]
withx != y
, then this impliest that the parameter is an array type, to which multiple objects can be connected. In other words, this implies thatgetPlugin().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 classjava.lang.Object
-
hashCode
public int hashCode()
Returns a hashcode based on the binding, plugin and complete status- Overrides:
hashCode
in classjava.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:
-
compareTo
public int compareTo(PluginParameterBinding other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<PluginParameterBinding>
-
-