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

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

package io.codemodder.remediation;

import io.codemodder.DependencyGAV;
import java.util.List;

/**
 * Represents the result of a strategy fix. Either a list of dependencies to be added, or a reason
 * for failure.
 */
public interface SuccessOrReason {

  /** Checks if the result is a success. */
  boolean isSuccess();

  /** Returns the dependencies to be added from a successful fix. */
  List getDependencies();

  /** Returns the reason for failure. Throw an exception if it's not a failure. */
  String getReason();

  static SuccessOrReason success() {
    return new DefaultSuccessOrReason(List.of());
  }

  static SuccessOrReason success(final List dependencies) {
    return new DefaultSuccessOrReason(dependencies);
  }

  static SuccessOrReason reason(final String reason) {
    return new DefaultSuccessOrReason(reason);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy