com.github.dakusui.floorplan.resolver.Resolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of floorplan Show documentation
Show all versions of floorplan Show documentation
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();
}
};
}
}