public final class IntroduceParameterRefactoring extends AbstractRefactoring
RefactoringPlugin
,
RefactoringPluginFactory
,
AbstractRefactoring
,
RefactoringSession
INIT, PARAMETERS_CHECK, PRE_CHECK, PREPARE
Constructor and Description |
---|
IntroduceParameterRefactoring(TreePathHandle handle)
Creates a new instance of introduce parameter refactoring.
|
Modifier and Type | Method and Description |
---|---|
String |
getParameterName()
The name used for the new parameter.
|
boolean |
isFinal()
Make the new Parameter final in the method declaration.
|
boolean |
isOverloadMethod()
Create a new overloading method with the new parameter and let the existing
method delegate to it:
e.g.
|
boolean |
isReplaceAll()
Replace all occurrences.
|
void |
setFinal(boolean isFinal)
Make the new Parameter final in the method declaration.
|
void |
setOverloadMethod(boolean overloadMethod)
Create a new overloading method with the new parameter and let the existing
method delegate to it:
e.g.
|
void |
setParameterName(String parameterName)
Change the name to use for the new Parameter.
|
void |
setReplaceAll(boolean isReplaceAll)
Replace all occurrences.
|
addProgressListener, cancelRequest, checkParameters, fastCheckParameters, getContext, getRefactoringSource, preCheck, prepare, removeProgressListener
public IntroduceParameterRefactoring(@NonNull TreePathHandle handle)
a + b, or an variable declaration, e.g.
String s = "Hello World!";
handle
- the element to be refactoredpublic boolean isOverloadMethod()
int foo() { return 1+1; }if "1+1" is selected, the code is converted to
int foo() { return foo(1+1); } int foo(int newparam) { return newparam; }
public void setOverloadMethod(boolean overloadMethod)
int foo() { return 1+1; }if "1+1" is selected, the code is converted to
int foo() { return foo(1+1); } int foo(int newparam) { return newparam; }
overloadMethod
- true if you want to create a new overloading methodpublic boolean isFinal()
int foo(final in newparam) { return newparam; }
public void setFinal(boolean isFinal)
int foo(final in newparam) { return newparam; }
isFinal
- true if the new parameter should be finalpublic boolean isReplaceAll()
int foo() { Sysmte.out.printline(1+1); return 1+1; }if "1+1" is selected, the code is converted to
int foo(int newparam) { Sysmte.out.printline(newparam); return newparam; }
public void setReplaceAll(boolean isReplaceAll)
int foo() { Sysmte.out.printline(1+1); return 1+1; }if "1+1" is selected, the code is converted to
int foo(int newparam) { Sysmte.out.printline(newparam); return newparam; }
isReplaceAll
- true if all occurrences should be changed@NonNull public String getParameterName()