org.as2lib.core.BasicInterface +--org.as2lib.env.overload.OverloadHandler
OverloadHandler
declares methods needed by overload handlers.
Overload handlers are used by the Overload class to identify the corresponding method for a specific list of arguments. Whereby the overload handler holds the method and the expected arguments' types of this method.
It also offers functionalities to match real arguments against the expected arguments' types, matches, and to determine which overload handler or rather which arguments' types of two handlers are more explicit, isMoreExplicit.
It also offers the ability to invoke/execute the target method on a target scope passing-in a list of arguments.
public function matches(realArguments:Array):Boolean
Checks whether the passed-in realArguments
match the expected arguments'
types of this overload handler.
realArguments | the real arguments to match against the arguments' types |
true
if the realArguments
match the arguments' types
else false
public function execute(target, args:Array)
Executes the method of this handler on the given target
passing-in the
given args
.
The this
scope of the method refers to the passed-in target
on execution.
target | the target object to invoke the method on |
args | the arguments to pass-in on method invocation |
the result of the method invocation
public function isMoreExplicit(handler:OverloadHandler):Boolean
Checks if this overload handler is more explicit than the passed-in
handler
.
What means more explicit? The type String
is for example more
explicit than Object
. The type org.as2lib.core.BasicClass
is
also more explicit than Object
. And the type
org.as2lib.env.overload.SimpleOverloadHandler
is more explicit than
org.as2lib.core.BasicClass
. I hope you get the image. As you can see,
the explicitness depends on the inheritance hierarchy.
Note that classes are supposed to be more explicit than interfaces.
handler | the handler to compare this handler with regarding explicitness |
true
if this handler is more explicit else false
or
null
if the two handlers have the same explicitness
public function getArgumentsTypes(Void):Array
Returns the arguments' types used to match against the real arguments.
The arguments' types determine for which types of arguments the method was declared for. That means which arguments' types the method expects.
the arguments' types the method expects
public function getMethod(Void):Function
Returns the method this overload handler was assigned to.
This is the method to invoke passing the appropriate arguments when this handler matches the arguments and is the most explicit one.
the method to invoke when the real arguments match the ones of this handler and this handler is the most explicit one