public void removeField(String oldName) { ClassNode r = redirect(); if (r.fieldIndex == null) r.fieldIndex = new HashMap<String, FieldNode>(); final Map<String, FieldNode> index = r.fieldIndex; r.fields.remove(index.get(oldName)); index.remove(oldName); }
public void addFieldFirst(FieldNode node) { final ClassNode r = redirect(); node.setDeclaringClass(r); node.setOwner(r); if (r.fields == null) r.fields = new LinkedList<FieldNode>(); if (r.fieldIndex == null) r.fieldIndex = new HashMap<String, FieldNode>(); r.fields.addFirst(node); r.fieldIndex.put(node.getName(), node); }
public void renameField(String oldName, String newName) { ClassNode r = redirect(); if (r.fieldIndex == null) r.fieldIndex = new HashMap<String, FieldNode>(); final Map<String, FieldNode> index = r.fieldIndex; index.put(newName, index.remove(oldName)); }