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

org.pitest.mutationtest.build.InterceptorParameters Maven / Gradle / Ivy

There is a newer version: 1.17.1
Show newest version
package org.pitest.mutationtest.build;

import org.pitest.classinfo.ClassByteArraySource;
import org.pitest.coverage.CoverageDatabase;
import org.pitest.mutationtest.config.ReportOptions;
import org.pitest.plugin.FeatureParameter;
import org.pitest.plugin.FeatureSetting;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

public final class InterceptorParameters {

  private final FeatureSetting conf;
  private final ReportOptions data;
  private final ClassByteArraySource source;
  private final CoverageDatabase coverage;


  public InterceptorParameters(FeatureSetting conf, ReportOptions data, CoverageDatabase coverage,
      ClassByteArraySource source) {
    this.conf = conf;
    this.data = data;
    this.coverage = coverage;
    this.source = source;
  }

  public ReportOptions data() {
    return this.data;
  }

  public CoverageDatabase coverage() {
    return this.coverage;
  }

  public Optional settings() {
    return Optional.ofNullable(this.conf);
  }


  public ClassByteArraySource source() {
    return this.source;
  }

  public Optional getString(FeatureParameter limit) {
    if (this.conf == null) {
      return Optional.empty();
    }
    return this.conf.getString(limit.name());
  }

  public List getList(FeatureParameter key) {
    if (this.conf == null) {
      return Collections.emptyList();
    }
    return this.conf.getList(key.name());
  }

  public Optional getInteger(FeatureParameter key) {
    final Optional val = getString(key);
    return val.map(Integer::parseInt);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy