refactor(extraction): Added utility constructor for optional name version.
@@ -29,6 +29,7 @@ import java.util.Map;
import java.util.Optional;
import com.synopsys.integration.detectable.detectable.codelocation.CodeLocation;
+import com.synopsys.integration.util.NameVersion;
public class Extraction {
private final List<CodeLocation> codeLocations;
@@ -116,6 +117,14 @@ public class Extraction {
return this;
}
+ public Builder nameVersionIfPresent(final Optional<NameVersion> nameVersion) {
+ if (nameVersion.isPresent()) {
+ this.projectName(nameVersion.get().getName());
+ this.projectVersion(nameVersion.get().getVersion());
+ }
+ return this;
+ }
+
public Builder codeLocations(final CodeLocation codeLocation) {
codeLocations.add(codeLocation);
return this;
