io.codemodder.RegionExtractor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codemodder-base Show documentation
Show all versions of codemodder-base Show documentation
Base framework for writing codemods in Java
package io.codemodder;
import com.contrastsecurity.sarif.Region;
import com.contrastsecurity.sarif.Result;
import com.contrastsecurity.sarif.ThreadFlowLocation;
/** A type responsible for extracting a region from a SARIF result */
public interface RegionExtractor {
/** Extract a region from a SARIF result. */
Region from(Result result);
RegionExtractor FROM_FIRST_LOCATION =
result -> result.getLocations().get(0).getPhysicalLocation().getRegion();
RegionExtractor FROM_FIRST_THREADFLOW_EVENT =
result -> {
ThreadFlowLocation location =
result.getCodeFlows().get(0).getThreadFlows().get(0).getLocations().get(0);
return location.getLocation().getPhysicalLocation().getRegion();
};
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy