All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lombok.eclipse.handlers.replace.VariableNameReplaceVisitor Maven / Gradle / Ivy

There is a newer version: 0.11.3
Show newest version
package lombok.eclipse.handlers.replace;

import static lombok.ast.AST.*;

import lombok.core.util.As;
import lombok.eclipse.handlers.ast.EclipseMethod;

import org.eclipse.jdt.internal.compiler.ast.*;

public class VariableNameReplaceVisitor extends ExpressionReplaceVisitor {
	private final String oldName;

	public VariableNameReplaceVisitor(final EclipseMethod method, final String oldName, final String newName) {
		super(method, Name(newName));
		this.oldName = oldName;
	}

	@Override
	protected boolean needsReplacing(final Expression node) {
		return (node instanceof SingleNameReference) && oldName.equals(As.string(((SingleNameReference) node).token));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy