01: /*
02: * Author: Chris Seguin
03: *
04: * This software has been developed under the copyleft
05: * rules of the GNU General Public License. Please
06: * consult the GNU General Public License for more
07: * details about use and distribution of this software.
08: */
09: package org.acm.seguin.refactor.field;
10:
11: import net.sourceforge.jrefactory.ast.SimpleNode;
12: import org.acm.seguin.refactor.TransformAST;
13: import org.acm.seguin.summary.FieldSummary;
14:
15: /**
16: * A transform that renames a specific field
17: *
18: *@author Chris Seguin
19: */
20: public class RenameFieldTransform extends TransformAST {
21: private FieldSummary oldField;
22: private String newName;
23:
24: /**
25: * Constructor for the RemoveFieldTransform object
26: *
27: *@param oldName Description of Parameter
28: *@param newName Description of Parameter
29: */
30: public RenameFieldTransform(FieldSummary oldField, String newName) {
31: this .oldField = oldField;
32: this .newName = newName;
33: }
34:
35: /**
36: * Updates the root
37: *
38: *@param root the root node
39: */
40: public void update(SimpleNode root) {
41: RenameFieldVisitor rfv = new RenameFieldVisitor();
42: rfv.visit(root, new RenameFieldData(oldField, newName));
43: }
44: }
|