org.netbeans.modules.refactoring.java/1 1.37.0 1

org.netbeans.modules.refactoring.java.api
Class IntroduceParameterRefactoring

java.lang.Object
  extended by org.netbeans.modules.refactoring.api.AbstractRefactoring
      extended by org.netbeans.modules.refactoring.java.api.IntroduceParameterRefactoring

public final class IntroduceParameterRefactoring
extends AbstractRefactoring

Introduce parameter refactoring

Since:
1.28
See Also:
RefactoringPlugin, RefactoringPluginFactory, AbstractRefactoring, RefactoringSession

Field Summary
 
Fields inherited from class org.netbeans.modules.refactoring.api.AbstractRefactoring
INIT, PARAMETERS_CHECK, PRE_CHECK, PREPARE
 
Constructor Summary
IntroduceParameterRefactoring(TreePathHandle handle)
          Creates a new instance of introduce parameter refactoring.
 
Method Summary
 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.
 
Methods inherited from class org.netbeans.modules.refactoring.api.AbstractRefactoring
addProgressListener, cancelRequest, checkParameters, fastCheckParameters, getContext, getRefactoringSource, preCheck, prepare, removeProgressListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntroduceParameterRefactoring

public IntroduceParameterRefactoring(@NonNull
                                     TreePathHandle handle)
Creates a new instance of introduce parameter refactoring. The element to be refactored can be either an expression, e.g.
a + b
, or an variable declaration, e.g.
String s = "Hello World!";

Parameters:
handle - the element to be refactored
Method Detail

isOverloadMethod

public boolean isOverloadMethod()
Create a new overloading method with the new parameter and let the existing method delegate to it: e.g.
 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;
 }
 

Returns:
true if a new overloading method will be created, false otherwise

setOverloadMethod

public void setOverloadMethod(boolean overloadMethod)
Create a new overloading method with the new parameter and let the existing method delegate to it: e.g.
 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;
 }
 

Parameters:
overloadMethod - true if you want to create a new overloading method

isFinal

public boolean isFinal()
Make the new Parameter final in the method declaration. e.g.
 int foo(final in newparam) {
     return newparam;
 }
 

Returns:
true if the new parameter will be final, false otherwise

setFinal

public void setFinal(boolean isFinal)
Make the new Parameter final in the method declaration. e.g.
 int foo(final in newparam) {
     return newparam;
 }
 

Parameters:
isFinal - true if the new parameter should be final

isReplaceAll

public boolean isReplaceAll()
Replace all occurrences. e.g.
 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;
 }
 

Returns:
true if all occurrences will be changed

setReplaceAll

public void setReplaceAll(boolean isReplaceAll)
Replace all occurrences. e.g.
 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;
 }
 

Parameters:
isReplaceAll - true if all occurrences should be changed

getParameterName

@NonNull
public String getParameterName()
The name used for the new parameter.

Returns:
the name of the new parameter

setParameterName

public void setParameterName(@NonNull
                             String parameterName)
Change the name to use for the new Parameter.

Parameters:
parameterName - a non empty String to use as the parameter name

org.netbeans.modules.refactoring.java/1 1.37.0 1

Built on May 25 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.