hi plz help me
i got a question in interview that
what is delegate method. why it is used and to which it extends..
Printable View
hi plz help me
i got a question in interview that
what is delegate method. why it is used and to which it extends..
Delegate Methods
Eclim supports generation of delegate methods via the :JavaDelegate command. To utilize this functionality you must first place the cursor on a global field (in the main source file class or within an inner class), and then invoke the :JavaDelegate command.
In the following source, you can place the cursor anywhere starting from the first 'p' in private, to the trailing semicolon, and then invoke the :JavaDelegate command.
private List myList;
Invoking this command with the cursor on some other source element will generate the appropriate error.
Once successfully invoked, the result will be the opening of a lower window with all the methods that may be inserted that will delegate to the value of the field.
Here is a section of the content displayed when invoking the command on a field of type java.util.List like the one above.
com.test.TestList
package java.util;
public interface List
public abstract int size ()
public abstract boolean isEmpty ()
public abstract boolean contains (Object o)
public abstract Object[] toArray ()
...
From this newly opened window you can select a method by simply hitting <Enter> with the cursor over the method signature and a delegate method will be created.