Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse JDT
Release 3.5

org.eclipse.jdt.core.refactoring.descriptors
Class IntroduceParameterObjectDescriptor

java.lang.Object
  extended by 

org.eclipse.ltk.core.refactoring.RefactoringDescriptor
      extended by 

org.eclipse.jdt.core.refactoring.descriptors.JavaRefactoringDescriptor
          extended by 
org.eclipse.jdt.core.refactoring.descriptors.IntroduceParameterObjectDescriptor
All Implemented Interfaces:
Comparable

public class IntroduceParameterObjectDescriptor
extends JavaRefactoringDescriptor

Refactoring descriptor for the introduce parameter object refactoring.

An instance of this refactoring descriptor may be obtained by calling RefactoringContribution.createDescriptor() on a refactoring contribution requested by invoking RefactoringCore.getRefactoringContribution(String) with the appropriate refactoring id.

Since:
1.2
Restriction:
This class is not intended to be subclassed by clients.
Restriction:
This class is not intended to be instantiated by clients.

Nested Class Summary
static class IntroduceParameterObjectDescriptor.Parameter
          Instances of Parameter are used to describe the position of parameter and fields.
 
Field Summary
static  IntroduceParameterObjectDescriptor.Parameter PARAMETER_OBJECT
          Singleton instance that represents the parameter object
static int PARAMETER_OBJECT_IDX
          The parameter index of the special parameter object.
 
Fields inherited from class org.eclipse.jdt.core.refactoring.descriptors. JavaRefactoringDescriptor
ATTRIBUTE_ELEMENT, ATTRIBUTE_INPUT, ATTRIBUTE_NAME, ATTRIBUTE_REFERENCES, ATTRIBUTE_SELECTION, ATTRIBUTE_VERSION, fArguments, JAR_MIGRATION, JAR_REFACTORING, JAR_SOURCE_ATTACHMENT, VALUE_VERSION_1_0
 
Fields inherited from class org.eclipse.ltk.core.refactoring. RefactoringDescriptor
BREAKING_CHANGE, ID_UNKNOWN, MULTI_CHANGE, NONE, STRUCTURAL_CHANGE, USER_CHANGE
 
Constructor Summary
IntroduceParameterObjectDescriptor ()
          Creates a new refactoring descriptor.
IntroduceParameterObjectDescriptor ( String project, String description, String comment, Map arguments, int flags)
          Creates a new refactoring descriptor.
 
Method Summary
static  IntroduceParameterObjectDescriptor.Parameter[] createParameters ( IMethod method)
          Creates the parameters for this method.
  String getClassName ()
          The name of the class that will be generated.
  IMethod getMethod ()
          The method the refactoring will operate on.
  String getPackageName ()
          The parameter object class will be created in this package if the top level is true.
  String getParameterName ()
          Returns the name of the parameter.
  IntroduceParameterObjectDescriptor.Parameter[] getParameters ()
          Returns the parameters.
 boolean isDelegate ()
          Returns true if delegates will be kept.
 boolean isDeprecateDelegate ()
          Returns true if delegates will be marked as deprecated.
 boolean isGetters ()
          Returns true if getters are generated for fields.
 boolean isSetters ()
          Returns true if setters are generated for fields.
 boolean isTopLevel ()
          Returns true if the new type is created as top level type.
protected  void populateArgumentMap ()
          Populates the refactoring descriptor argument map based on the specified arguments.
 void setClassName ( String className)
          Sets the name of the class for the generated parameter object.
 void setDelegate (boolean delegate)
          Sets delegate keeping.
 void setDeprecateDelegate (boolean deprecateDelegate)
          Sets deprecate delegate.
 void setGetters (boolean getters)
          Sets whether getters will be created for all fields.
 void setMethod ( IMethod method)
          Sets the method.
 void setPackageName ( String packageName)
          Sets the package where the parameter object will be created in if it is created as top level class.
 void setParameterName ( String parameterName)
          Sets the name of the parameter object as it will appear in the method signature.
 void setParameters ( IntroduceParameterObjectDescriptor.Parameter[] parameters)
          Sets the parameters.
 void setSetters (boolean setters)
          Sets whether setters will be created for all fields.
 void setTopLevel (boolean topLevel)
          Sets whether the parameter object class will be created as top level class.
  RefactoringStatus validateDescriptor ()
          Validates the refactoring descriptor with respect to the constraints imposed by the represented refactoring.
 
Methods inherited from class org.eclipse.jdt.core.refactoring.descriptors. JavaRefactoringDescriptor
createRefactoring, elementToHandle, getArguments, handleToElement, handleToElement, handleToElement, handleToResource, resourceToHandle, setComment, setDescription, setFlags, setProject
 
Methods inherited from class org.eclipse.ltk.core.refactoring. RefactoringDescriptor
compareTo, equals, getComment, getDescription, getFlags, getID, getProject, getTimeStamp, hashCode, setTimeStamp, toString
 
Methods inherited from class java.lang. Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAMETER_OBJECT_IDX

public static final int PARAMETER_OBJECT_IDX
The parameter index of the special parameter object. The value is "-1".

See Also:
Constant Field Values

PARAMETER_OBJECT

public static final 
IntroduceParameterObjectDescriptor.Parameter PARAMETER_OBJECT
Singleton instance that represents the parameter object

Constructor Detail

IntroduceParameterObjectDescriptor

public IntroduceParameterObjectDescriptor()
Creates a new refactoring descriptor.


IntroduceParameterObjectDescriptor

public IntroduceParameterObjectDescriptor(
String project,
                                          
String description,
                                          
String comment,
                                          
Map arguments,
                                          int flags)
                                   throws 
IllegalArgumentException
Creates a new refactoring descriptor.

Parameters:
project - the non-empty name of the project associated with this refactoring, or null for a workspace refactoring
description - a non-empty human-readable description of the particular refactoring instance
comment - the human-readable comment of the particular refactoring instance, or null for no comment
arguments - a map of arguments that will be persisted and describes all settings for this refactoring
flags - the flags of the refactoring descriptor
Throws:
IllegalArgumentException - if the argument map contains invalid keys/values
Method Detail

createParameters

public static 
IntroduceParameterObjectDescriptor.Parameter[] createParameters(
IMethod method)
Creates the parameters for this method. The first object is the parameter object. By default all parameters are marked for field creation

Parameters:
method - derive parameter from this method
Returns:
an array of parameter corresponding to the parameter declared in the method. The first object will be the parameter object. All parameter are marked for field creation

getClassName

public 
String getClassName()
The name of the class that will be generated. If null the refactoring will automatically choose a class name.

Returns:
the name of the class that will be generated or null if the name will be automatically chosen

getMethod

public 
IMethod getMethod()
The method the refactoring will operate on. Can be set using setMethod(IMethod).

Returns:
the method that the refactoring will operate on.

getPackageName

public 
String getPackageName()
The parameter object class will be created in this package if the top level is true. Can be set using setPackageName(String). If the package name was null and the method has already been set this method returns the package where the method is declared in.

Returns:
the package name that has been set or the package where the method is declared. Can return null if neither the package nor the method has been set

getParameterName

public 
String getParameterName()
Returns the name of the parameter. Can return null in which case the refactoring chooses a name. Default is null

Returns:
the name of the parameter. Can return null in which case the refactoring chooses a name. Default is null

getParameters

public 
IntroduceParameterObjectDescriptor.Parameter[] getParameters()
Returns the parameters. Can return null if all parameters should be converted to fields. Default is null.

Returns:
the parameters. Can return null if all parameters should be converted to fields. Default is null

isDelegate

public boolean isDelegate()
Returns true if delegates will be kept. Default is false.

Returns:
true if delegates will be kept. Default is false

isDeprecateDelegate

public boolean isDeprecateDelegate()
Returns true if delegates will be marked as deprecated. Default is false.

Returns:
true if delegates will be marked as deprecated. Default is false

isGetters

public boolean isGetters()
Returns true if getters are generated for fields. Default is false.

Returns:
true if getters are generated for fields. Default is false

isSetters

public boolean isSetters()
Returns true if setters are generated for fields. Default is false.

Returns:
true if setters are generated for fields. Default is false

isTopLevel

public boolean isTopLevel()
Returns true if the new type is created as top level type. false is returned when the type is created as enclosing type of the type declaring the method declaration to be changed. Default is true.

Returns:
true if the new type is created as top level type. false is returned when the type is created as enclosing type of the type declaring the method declaration to be changed. Default is true

populateArgumentMap

protected void populateArgumentMap()
Description copied from class: JavaRefactoringDescriptor
Populates the refactoring descriptor argument map based on the specified arguments. Subclasses should extend and add their arguments to JavaRefactoringDescriptor.fArguments.

Overrides:
populateArgumentMap in class JavaRefactoringDescriptor

setClassName

public void setClassName(
String className)
Sets the name of the class for the generated parameter object. The name can be null to indicate that the refactoring should chose one.

Parameters:
className - the name of the generated class or null. Default is null

setDelegate

public void setDelegate(boolean delegate)
Sets delegate keeping. If true delegates will be kept.

Parameters:
delegate - true to keep delegates. Default is false

setDeprecateDelegate

public void setDeprecateDelegate(boolean deprecateDelegate)
Sets deprecate delegate. If true generated delegates will be marked as deprecated.

Parameters:
deprecateDelegate - true to deprecate kept delegates. Default is false

setGetters

public void setGetters(boolean getters)
Sets whether getters will be created for all fields.

Parameters:
getters - true to create getters. Default is false.

setMethod

public void setMethod(
IMethod method)
Sets the method. The method may not be null, has to exist, and has to be in a Java project.

Parameters:
method - the method. May not be null

setPackageName

public void setPackageName(
String packageName)
Sets the package where the parameter object will be created in if it is created as top level class. The package can be null to indicate that the package of the method should be used.

Parameters:
packageName - the package for the top level class or null. Default is null.

setParameterName

public void setParameterName(
String parameterName)
Sets the name of the parameter object as it will appear in the method signature. The name can be null to indicate that the refactoring will choose a name.

Parameters:
parameterName - the name of the parameter or null. Default is null.

setParameters

public void setParameters(
IntroduceParameterObjectDescriptor.Parameter[] parameters)
Sets the parameters. The parameters can be null to indicate that all parameter should be used as fields. If not null, the number of parameters passed has to be the number of parameter of the method + 1. One element has to be the PARAMETER_OBJECT. Each parameter may only appear once.

Parameters:
parameters - the parameters or null. Default is null

setSetters

public void setSetters(boolean setters)
Sets whether setters will be created for all fields.

Parameters:
setters - true to create setters. Default is false

setTopLevel

public void setTopLevel(boolean topLevel)
Sets whether the parameter object class will be created as top level class. if true the class will be created as top level class in the package returned by getPackageName(). If false the class will be created as as nested class in the class containing the method

Parameters:
topLevel - true to create the parameter object as top level. Default is true

validateDescriptor

public 
RefactoringStatus validateDescriptor()
Validates the refactoring descriptor with respect to the constraints imposed by the represented refactoring.

Clients must call this method to verify that all arguments have been correctly set and that they satisfy the constraints imposed by specific refactorings. Returning a refactoring status of severity RefactoringStatus.FATAL indicates that the refactoring descriptor cannot be used to create a refactoring instance.

Overrides:
validateDescriptor in class JavaRefactoringDescriptor
Returns:
a refactoring status describing the outcome of the validation

Eclipse JDT
Release 3.5

Copyright (c) IBM Corp. and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire