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

jio.Fun Maven / Gradle / Ivy

The newest version!
package jio;

import java.time.Duration;
import java.util.function.Function;
import java.util.function.Supplier;

/**
 * Class with handy functions for development with jio
 */
final class Fun {

  private Fun() {
  }

  static  Function, Supplier> mapSupplier(Function map) {
    return supplier -> () -> map.apply(supplier.get());
  }

  static void publishException(String exp,
                               Throwable exc) {
    EvalExpEvent event = new EvalExpEvent();
    event.exception = String.format("%s:%s",
                                    exc.getClass()
                                       .getName(),
                                    exc.getMessage());
    event.result = EvalExpEvent.RESULT.FAILURE.name();
    event.expression = exp;
    event.commit();
  }

   static void sleep(Duration duration){
    try {
      Thread.sleep(duration.toMillis());
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
    }
   }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy