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

io.codemodder.remediation.LegacyFixCandidateSearcher Maven / Gradle / Ivy

There is a newer version: 0.97.9
Show newest version
package io.codemodder.remediation;

import com.github.javaparser.ast.CompilationUnit;
import io.codemodder.codetf.DetectorRule;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import java.util.function.Predicate;

/** Searches for potential fix locations in the source code. */
@Deprecated
public interface LegacyFixCandidateSearcher {

  /** Searches for potential fix locations in the source code. */
  LegacyFixCandidateSearchResults search(
      CompilationUnit cu,
      String path,
      DetectorRule rule,
      List issuesForFile,
      Function getKey,
      Function getStartLine,
      Function getEndLine,
      Function getColumn);

  /** Builder for {@link LegacyFixCandidateSearcher}. */
  final class Builder {
    private String methodName;
    private final List> methodMatchers;

    public Builder() {
      this.methodMatchers = new ArrayList<>();
    }

    public Builder withMethodName(final String methodName) {
      this.methodName = Objects.requireNonNull(methodName);
      return this;
    }

    public Builder withMatcher(final Predicate methodMatcher) {
      this.methodMatchers.add(Objects.requireNonNull(methodMatcher));
      return this;
    }

    public LegacyFixCandidateSearcher build() {
      return new DefaultLegacyFixCandidateSearcher<>(methodName, List.copyOf(methodMatchers));
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy