public final class ChangeParametersRefactoring extends AbstractRefactoring
Modifier and Type | Class and Description |
---|---|
static class |
ChangeParametersRefactoring.ParameterInfo
Represents one item for setParameters(List params) list parameter.
|
INIT, PARAMETERS_CHECK, PRE_CHECK, PREPARE
Constructor and Description |
---|
ChangeParametersRefactoring(TreePathHandle method)
Creates a new instance of change parameters refactoring.
|
Modifier and Type | Method and Description |
---|---|
String |
getMethodName()
Get the new method name.
|
Set<Modifier> |
getModifiers()
Getter for new modifiers
|
ChangeParametersRefactoring.ParameterInfo[] |
getParameterInfo()
Getter for new parameters
|
String |
getReturnType()
Get the new return type.
|
boolean |
isOverloadMethod()
Create a new overloading method with the new parameter and let the existing
method delegate to it:
e.g.
|
void |
setMethodName(String methodName)
Sets the new method name.
|
void |
setModifiers(Set<Modifier> modifiers)
Sets modifiers for method
|
void |
setOverloadMethod(boolean overloadMethod)
Create a new overloading method with the new parameter and let the existing
method delegate to it:
e.g.
|
void |
setParameterInfo(ChangeParametersRefactoring.ParameterInfo[] paramTable)
Sets new parameters for a method
|
void |
setReturnType(String returnType)
Sets the new return type for the method.
|
addProgressListener, cancelRequest, checkParameters, fastCheckParameters, getContext, getRefactoringSource, preCheck, prepare, removeProgressListener
public ChangeParametersRefactoring(TreePathHandle method)
method
- refactored object, i.e. method or constructorpublic ChangeParametersRefactoring.ParameterInfo[] getParameterInfo()
@CheckForNull public String getReturnType()
@CheckForNull public String getMethodName()
public void setParameterInfo(ChangeParametersRefactoring.ParameterInfo[] paramTable)
paramTable
- new parameterspublic void setModifiers(Set<Modifier> modifiers)
modifiers
- new modifierspublic void setMethodName(@NullAllowed String methodName)
methodName
- the new method name, null if it does not changepublic void setReturnType(@NullAllowed String returnType)
returnType
- the return type to set, null if it does not changepublic 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 method