org.acm.seguin.refactor.type
Class AddChildRefactoring

java.lang.Object
  extended by org.acm.seguin.refactor.Refactoring
      extended by org.acm.seguin.refactor.type.AddClassRefactoring
          extended by org.acm.seguin.refactor.type.AddChildRefactoring

public class AddChildRefactoring
extends AddClassRefactoring

Adds a child class and makes sure that the rest of the system is ready to have a class with that name.

Author:
Chris Seguin

Field Summary
 
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 AddChildRefactoring()
          Constructor for the AddChildRefactoring object
 
Method Summary
protected  void createClass(TypeSummary existingType, java.lang.String className)
          Creates a class
 java.lang.String getDescription()
          Gets the description of the refactoring
 int getID()
          Gets the id for this refactoring to track which refactorings are used.
 void setChildName(java.lang.String value)
          Sets the name of the child class to be created
 void setPackageName(java.lang.String value)
          Sets the name of the package of the new child class
 void setParentClass(java.lang.String packageName, java.lang.String className)
          Sets the ChildClass attribute of the AddClassRefactoring object
 void setParentClass(TypeSummary summary)
          Sets the ChildClass attribute of the AddClassRefactoring object
protected  void transformOriginal(TypeSummary typeSummary)
          Transforms the original AST.
 
Methods inherited from class org.acm.seguin.refactor.type.AddClassRefactoring
addTargetClass, getNewClassName, preconditions, setNewClassName, transform
 
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
 

Constructor Detail

AddChildRefactoring

protected AddChildRefactoring()
Constructor for the AddChildRefactoring object

Method Detail

setChildName

public void setChildName(java.lang.String value)
Sets the name of the child class to be created

Parameters:
value - the name of the child class

setParentClass

public void setParentClass(java.lang.String packageName,
                           java.lang.String className)
Sets the ChildClass attribute of the AddClassRefactoring object

Parameters:
packageName - The feature to be added to the ChildClass attribute
className - The feature to be added to the ChildClass attribute

setParentClass

public void setParentClass(TypeSummary summary)
Sets the ChildClass attribute of the AddClassRefactoring object

Parameters:
summary - The feature to be added to the ChildClass attribute

setPackageName

public void setPackageName(java.lang.String value)
Sets the name of the package of the new child class

Parameters:
value - the package name

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 for this refactoring to track which refactorings are used.

Specified by:
getID in class Refactoring
Returns:
the id

createClass

protected void createClass(TypeSummary existingType,
                           java.lang.String className)
Creates a class

Specified by:
createClass in class AddClassRefactoring
Parameters:
existingType - the existing type
className - the name of the new class

transformOriginal

protected void transformOriginal(TypeSummary typeSummary)
Transforms the original AST. For a child refactoring, we don't need to do anything special to the original type.

Specified by:
transformOriginal in class AddClassRefactoring
Parameters:
typeSummary - the particular type that is being changed