01: package org.acm.seguin.refactor.field;
02:
03: import net.sourceforge.jrefactory.ast.SimpleNode;
04: import org.acm.seguin.refactor.TransformAST;
05:
06: /**
07: * A transform that removes a specific field
08: *
09: *@author Chris Seguin
10: */
11: public class RemoveFieldTransform extends TransformAST {
12: private SimpleNode fieldDecl;
13: private String field;
14:
15: /**
16: * Constructor for the RemoveFieldTransform object
17: *
18: *@param init the name of the field
19: */
20: public RemoveFieldTransform(String init) {
21: field = init;
22: }
23:
24: /**
25: * Gets the FieldDeclaration attribute of the RemoveFieldTransform object
26: *
27: *@return The FieldDeclaration value
28: */
29: public SimpleNode getFieldDeclaration() {
30: return fieldDecl;
31: }
32:
33: /**
34: * Updates the root
35: *
36: *@param root the ro
37: */
38: public void update(SimpleNode root) {
39: RemoveFieldVisitor rfv = new RemoveFieldVisitor(field);
40: rfv.visit(root, null);
41: fieldDecl = rfv.getFieldDeclaration();
42: }
43: }
|