lombok.eclipse.handlers.replace.VariableNameReplaceVisitor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lombok-pg Show documentation
Show all versions of lombok-pg Show documentation
lombok-pg is a collection of extensions to Project Lombok
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