org.acm.seguin.refactor.field
Class PushDownFieldRefactoring

java.lang.Object
  extended by org.acm.seguin.refactor.Refactoring
      extended by org.acm.seguin.refactor.field.PushDownFieldRefactoring

public class PushDownFieldRefactoring
extends Refactoring

Performs the push down field refactoring

Author:
Chris Seguin

Field Summary
protected  java.lang.String field
          The name of the field
protected  TypeSummary typeSummary
          The type summary that contains the field
 
Fields inherited from class org.acm.seguin.refactor.Refactoring
ADD_CHILD, ADD_PARENT, EXTRACT_INTERFACE, EXTRACT_METHOD, MOVE_METHOD, PUSH_DOWN_FIELD, PUSH_DOWN_METHOD, PUSH_UP_ABSTRACT_METHOD, PUSH_UP_FIELD, PUSH_UP_METHOD, REMOVE_CLASS, RENAME_CLASS, RENAME_FIELD, RENAME_METHOD, RENAME_PARAMETER, REPACKAGE
 
Constructor Summary
protected PushDownFieldRefactoring()
          Constructor for the PushDownFieldRefactoring object
 
Method Summary
 void addChild(java.lang.String packageName, java.lang.String className)
          Adds a child class where the field should be pushed into
 void addChild(TypeSummary init)
          Adds a child class where the field should be pushed into
 java.lang.String getDescription()
          Gets the description of the refactoring
protected  java.lang.Object getFieldType(net.sourceforge.jrefactory.ast.SimpleNode node, FileSummary fileSummary)
          Gets the FieldType attribute of the PullupFieldRefactoring object
protected  FileSummary getFileSummary(Summary current)
          Gets the package summary for the specific object
 int getID()
          Gets the ID attribute of the PushDownFieldRefactoring object
protected  PackageSummary getPackage(Summary current)
          Gets the package summary for the specific object
protected  boolean isInJavaLang(net.sourceforge.jrefactory.ast.ASTName type)
          Determines if the specified type is in java.lang package
protected  boolean isInJavaLang(TypeSummary type)
          Determines if the specified type is in java.lang package
protected  void preconditions()
          Preconditions that must be true for the refactoring to work
 void setClass(java.lang.String packageName, java.lang.String className)
          Sets the Class attribute of the PullupFieldRefactoring object
 void setClass(TypeSummary init)
          Sets the Class attribute of the PullupFieldRefactoring object
 void setField(java.lang.String fieldName)
          Sets the Field attribute of the PullupFieldRefactoring object
protected  void transform()
          Actually update the files
 
Methods inherited from class org.acm.seguin.refactor.Refactoring
checkDestinationFile, getComplexTransform, run, setComplexTransform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

field

protected java.lang.String field
The name of the field


typeSummary

protected TypeSummary typeSummary
The type summary that contains the field

Constructor Detail

PushDownFieldRefactoring

protected PushDownFieldRefactoring()
Constructor for the PushDownFieldRefactoring object

Method Detail

getDescription

public java.lang.String getDescription()
Gets the description of the refactoring

Specified by:
getDescription in class Refactoring
Returns:
the description

getID

public int getID()
Gets the ID attribute of the PushDownFieldRefactoring object

Specified by:
getID in class Refactoring
Returns:
The ID value

addChild

public void addChild(java.lang.String packageName,
                     java.lang.String className)
Adds a child class where the field should be pushed into

Parameters:
packageName - the package name
className - the class name

addChild

public void addChild(TypeSummary init)
Adds a child class where the field should be pushed into

Parameters:
init - The new Class value

preconditions

protected void preconditions()
                      throws RefactoringException
Preconditions that must be true for the refactoring to work

Specified by:
preconditions in class Refactoring
Throws:
RefactoringException - a problem with performing this refactoring

transform

protected void transform()
Actually update the files

Specified by:
transform in class Refactoring

setClass

public void setClass(java.lang.String packageName,
                     java.lang.String className)
Sets the Class attribute of the PullupFieldRefactoring object

Parameters:
packageName - the package name
className - the class name

setClass

public void setClass(TypeSummary init)
Sets the Class attribute of the PullupFieldRefactoring object

Parameters:
init - The new Class value

setField

public void setField(java.lang.String fieldName)
Sets the Field attribute of the PullupFieldRefactoring object

Parameters:
fieldName - The new Field value

isInJavaLang

protected boolean isInJavaLang(net.sourceforge.jrefactory.ast.ASTName type)
Determines if the specified type is in java.lang package

Parameters:
type - the type
Returns:
true if it is in the package

isInJavaLang

protected boolean isInJavaLang(TypeSummary type)
Determines if the specified type is in java.lang package

Parameters:
type - the type
Returns:
true if it is in the package

getPackage

protected PackageSummary getPackage(Summary current)
Gets the package summary for the specific object

Parameters:
current - the summary
Returns:
the package summary

getFileSummary

protected FileSummary getFileSummary(Summary current)
Gets the package summary for the specific object

Parameters:
current - the summary
Returns:
the package summary

getFieldType

protected java.lang.Object getFieldType(net.sourceforge.jrefactory.ast.SimpleNode node,
                                        FileSummary fileSummary)
Gets the FieldType attribute of the PullupFieldRefactoring object

Parameters:
node - Description of Parameter
fileSummary - Description of Parameter
Returns:
The FieldType value