org.acm.seguin.refactor.type
Class AddClassRefactoring

java.lang.Object
  extended by org.acm.seguin.refactor.Refactoring
      extended by org.acm.seguin.refactor.type.AddClassRefactoring
Direct Known Subclasses:
AddAbstractParent, AddChildRefactoring

public abstract class AddClassRefactoring
extends Refactoring

Adds a class that is either a parent or a child of an existing 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
AddClassRefactoring()
          Constructor for the AddClassRefactoring object
 
Method Summary
protected  void addTargetClass(TypeSummary summary)
          Adds a target class - either the parent or the child, depending on what we are adding
protected abstract  void createClass(TypeSummary existingType, java.lang.String className)
          Creates a class
protected  java.lang.String getNewClassName()
          Gets the name of the new class
protected  void preconditions()
          Describes the preconditions that must be true for this refactoring to be applied
protected  void setNewClassName(java.lang.String value)
          Sets the name of the new class
protected  void transform()
          Performs the transform on the rest of the classes
protected abstract  void transformOriginal(TypeSummary typeSummary)
          Transforms the original AST
 
Methods inherited from class org.acm.seguin.refactor.Refactoring
checkDestinationFile, getComplexTransform, getDescription, getID, run, setComplexTransform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddClassRefactoring

public AddClassRefactoring()
Constructor for the AddClassRefactoring object

Method Detail

setNewClassName

protected void setNewClassName(java.lang.String value)
Sets the name of the new class

Parameters:
value - the name of the new class

getNewClassName

protected java.lang.String getNewClassName()
Gets the name of the new class

Returns:
the name

addTargetClass

protected void addTargetClass(TypeSummary summary)
Adds a target class - either the parent or the child, depending on what we are adding

Parameters:
summary - the summary to be extended

preconditions

protected void preconditions()
                      throws RefactoringException
Describes the preconditions that must be true for this refactoring to be applied

Specified by:
preconditions in class Refactoring
Throws:
RefactoringException - thrown if one or more of the preconditions is not satisfied. The text of the exception provides a hint of what went wrong.

transform

protected void transform()
Performs the transform on the rest of the classes

Specified by:
transform in class Refactoring

createClass

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

Parameters:
existingType - the existing type
className - the name of the new class

transformOriginal

protected abstract void transformOriginal(TypeSummary typeSummary)
Transforms the original AST

Parameters:
typeSummary - the particular type that is being changed