com.github.dakusui.actionunit.connectors.Pipe Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of actionunit Show documentation
Show all versions of actionunit Show documentation
A library to build 'action' structure for testing
package com.github.dakusui.actionunit.connectors;
import com.github.dakusui.actionunit.Context;
import com.github.dakusui.actionunit.Utils;
import static com.github.dakusui.actionunit.connectors.Connectors.composeContextValues;
/**
* Executes an operation based on an input value and gives an output value.
*
* @param Type of input value
* @param Type of output value
*/
public interface Pipe {
O apply(I input, Context context);
abstract class Base implements Pipe {
private final String description;
protected Base(String description) {
this.description = description;
}
protected Base() {
this(null);
}
@Override
public O apply(I input, Context context) {
return this.apply(input, composeContextValues(context));
}
/**
* Applies this pipe to {@code input}.
*
* @param input An input to apply this object.
* @param outer Inputs from outer {@code With} actions.
*/
abstract protected O apply(I input, Object... outer);
@Override
public String toString() {
return this.description == null
? Utils.shortClassNameOf(this.getClass())
: description;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy