I am using eclipse and have an interface that is used by many of my classes. Right now, I'd like to add a variable(parameter) to one of the methods in the interface but I don't want to have to go through all of my classes to add the variable manually to each method when I may not even be using that variable in all of those classes.
Is there an easy and quick way to do this without having to do it all manually?
Example:
public interface Screen {
public void render(GameContainer arg0, Graphics g) throws SlickException;
}
I would like to add the parameter ResourcePack like this:
public interface Screen {
public void render(GameContainer arg0, Graphics g, ResourcePack pack) throws SlickException;
}
I would like it to add another parameter and have it update all the classes that inherit this method with that parameter so I don't have to do this manually.
Place the cursor on the method and enter :
Shift + Alt + C
.You would have a wizard to change the signature of the method (add, remove, edit and order change).
A thing that may be important when you a add a new argument is choosing a default value when it is called.
Here is a simple guide line :
null
is an acceptable default value, keepnull
.null
value as default value but enter something which doesn't compile in order to be sure that you will have to edit the caller of the method.