Questions tagged [method-invocation]
132 questions
70
votes
8 answers
How to execute a method passed as parameter to function
I want to write my own function in JavaScript which takes a callback method as a parameter and executes it after the completion, I don't know how to invoke a method in my method which is passed as an argument. Like Reflection.
example code
function…
![](../../users/profiles/161885.webp)
Muhammad Ummar
- 3,426
- 4
- 36
- 68
35
votes
5 answers
What is the difference between message-passing and method-invocation?
Is there a difference between message-passing and method-invocation, or can they be considered equivalent? This is probably specific to the language; many languages don't support message-passing (though all the ones I can think of support methods)…
![](../../users/profiles/430175.webp)
Scrollbar
- 721
- 2
- 7
- 6
30
votes
6 answers
How to suspend a java thread for a small period of time, like 100 nanoseconds?
I know Thread.sleep() can make a java thread suspend for a while, like certain milliseconds and certain nanoseconds. But the problem is the invocation of this function also causes overhead.
For example, if I want a thread to suspend for 100…
![](../../users/profiles/1258409.webp)
JackWM
- 8,835
- 18
- 58
- 90
18
votes
1 answer
Understanding the Dispatcher Queue
I think I need some help understanding the Dispatcher Queue.
When new work arrives it gets added at the beginning of the dispatcher queue and when the Dispatcher wants to process a working item it gets removed from the beginning.
In more general…
![](../../users/profiles/946904.webp)
marc wellman
- 5,261
- 5
- 28
- 55
15
votes
3 answers
MethodInvoke delegate or lambda expression
What is the difference between the two?
Invoke((MethodInvoker) delegate {
checkedListBox1.Items.RemoveAt(i);
checkedListBox1.Items.Insert(i, temp + validity);
checkedListBox1.Update();
}
);
vs
Invoke((MethodInvoker)
…
![](../../users/profiles/822426.webp)
Jack
- 5,322
- 8
- 43
- 70
15
votes
3 answers
Invoke method with an array parameter using reflection
I am attempting to write a method the executes a static method from another class by passing an array of strings as arguments to the method.
Here's what I have:
public static void
executeStaticCommand(final String[] command, Class> provider)
{
…
![](../../users/profiles/1280997.webp)
azz
- 5,596
- 3
- 28
- 56
12
votes
1 answer
Hit a bean method and redirect on a GET request
I'm using JSF 2 and PrimeFaces 2.1 on GlassFish.
I have a page that is intended to allow people to perform an action after following a callback URL (e.g. as link embedded in email or as callback URL parameter of some external authentication or…
user550738
9
votes
2 answers
Ambiguous invocation caused by picking up two versions of System.Linq
I have the following code, which shows a squiggly red line under the lambda expression after .Any( because of an "ambiguous invocation" between System.Linq versions 3.5 and 4.0 - how do I force it to use a particular version?
It compiles and runs…
![](../../users/profiles/622353.webp)
greg84
- 7,225
- 2
- 30
- 40
8
votes
2 answers
perl constructor keyword 'new'
I am new to Perl and currently learning Perl object oriented and came across writing a constructor.
It looks like when using new for the name of the subroutine the first parameter will be the package name.
Must the constructor be using the keyword…
![](../../users/profiles/2763829.webp)
user2763829
- 713
- 2
- 10
- 20
7
votes
2 answers
Example of multiple maximally specific methods that does not result in a compile-time error
I needed to dig into the specifics of method invocation in Java, and while reading the section Choosing the Most Specific Method in The Java Language Specification (Java SE 12 Edition), I found that (1) during invocation multiple methods can be…
![](../../users/profiles/5832619.webp)
johnnyodonnell
- 1,446
- 11
- 27
7
votes
3 answers
Dynamically Invoking Class Method Args
I am working on something where I need to be able to pass an indexed array of args to a method, much like how call_user_func_array works. I would use call_user_func_array but it is not an OOP approach, which is undesired, and it requires the method…
![](../../users/profiles/1431239.webp)
Mike Mackintosh
- 13,156
- 6
- 54
- 83
6
votes
2 answers
How to check if a subroutine was called with an object invocation method or not
You can invoke a subroutine as a method using the two syntaxes in the example below.
But you can also invoke it not as an object.
#====================================================
package Opa;
sub opa{
$first= shift;
$second= shift;
…
![](../../users/profiles/3367051.webp)
Diego Saravia
- 105
- 4
6
votes
4 answers
How to invoke method on proxy(Spring AOP) by reflection in Java?
An interface:
public interface Manager {
Object read(Long id);
}
A class which implements this interface:
@Transactional
Public class ManagerImpl implements Manager {
@Override
public Object read(Long id) {
// Implementation here
…
![](../../users/profiles/4552670.webp)
Radon
- 61
- 1
- 2
5
votes
2 answers
Message versus Signal for Method invocation in Sequence digram
I am studying a UML sequence Diagram and I came across method invocation so, I have noticed that there are two ways to make invocation for the method-behavior in Unified Modeling Language(UML) which is signal and message but I don't know how to…
![](../../users/profiles/3100186.webp)
Melisa
- 207
- 1
- 8
4
votes
1 answer
Why is ** optional when "splatting" keyword arguments?
Given this method definition:
def foo(a = nil, b: nil)
p a: a, b: b
end
When I invoke the method with a single hash argument, the hash is always implicitly converted to keyword arguments, regardless of **:
hash = {b: 1}
foo(hash) #=>…
![](../../users/profiles/477037.webp)
Stefan
- 96,300
- 10
- 122
- 186