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

com.github.dakusui.floorplan.resolver.Resolver Maven / Gradle / Ivy

Go to download

A library to model a heterogeneous and distributed software system for testing

The newest version!
package com.github.dakusui.floorplan.resolver;

import com.github.dakusui.floorplan.component.Attribute;
import com.github.dakusui.floorplan.component.Configurator;
import com.github.dakusui.floorplan.policy.Policy;

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

public interface Resolver extends Function, Function> {
  default T apply(Configurator configurator, Policy policy) {
    return this.apply(configurator).apply(policy);
  }

  static  Resolver of(Function, Function> func) {
    return of(func, () -> "Resolver(noname)");
  }

  static  Resolver of(Function, Function> func, Supplier messageComposer) {
    return new Resolver() {
      @Override
      public Function apply(Configurator configurator) {
        return policy -> func.apply(configurator).apply(policy);
      }

      @Override
      public String toString() {
        return messageComposer.get();
      }
    };
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy