org.acm.seguin.refactor.type
Class AddAbstractParent

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.AddAbstractParent

public class AddAbstractParent
extends AddClassRefactoring

Adds an abstract parent to a class or a set of classes in the same package. The parent class that is created must be in the same package as the child classes that extend it. It is created with the package level scope, to minimize interactions elsewhere in the system. However, the other source files that import this class are proactively updated to minimize the name conflicts in the event that the user later wants to make the abstract class a public class.

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 AddAbstractParent()
          Constructor for the AddAbstractParent object
 
Method Summary
 void addChildClass(java.lang.String packageName, java.lang.String className)
          Sets the ChildClass attribute of the AddClassRefactoring object
 void addChildClass(TypeSummary summary)
          Sets the ChildClass attribute of the AddClassRefactoring object
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 setParentName(java.lang.String parent)
          Sets the ParentName attribute of the AddAbstractParent 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

AddAbstractParent

protected AddAbstractParent()
Constructor for the AddAbstractParent object

Method Detail

setParentName

public void setParentName(java.lang.String parent)
Sets the ParentName attribute of the AddAbstractParent object

Parameters:
parent - The new ParentName value

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

addChildClass

public void addChildClass(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

addChildClass

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

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

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

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