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

io.github.oliviercailloux.jaris.exceptions.Unchecked Maven / Gradle / Ivy

There is a newer version: 0.0.38
Show newest version
package io.github.oliviercailloux.jaris.exceptions;

import io.github.oliviercailloux.jaris.throwing.TRunnable;
import io.github.oliviercailloux.jaris.throwing.TSupplier;

public interface Unchecked {
  /**
   * Calls the given runnable; if it throws a checked exception, throws a transformed exception
   * instead, applying the wrapper; if the runnable throws an unchecked exception, the exception is
   * thrown unchanged.
   *
   * @param runnable the runnable to call
   * @throws Y if the runnable throws a checked exception, or an unchecked exception of type Y
   */
  public void call(TRunnable runnable) throws Y;

  /**
   * Attempts to get and return a result from the given supplier; if the supplier throws a checked
   * exception, throws a transformed exception instead, applying the wrapper; if the supplier throws
   * an unchecked exception, the exception is thrown unchanged.
   *
   * @param  the type returned by the supplier
   * @param supplier the supplier to invoke
   * @return the result obtained from the supplier
   * @throws Y if the supplier throws a checked exception, or an unchecked exception of type Y
   */
  public  T getUsing(TSupplier supplier) throws Y;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy