io.magentys.java8.MissionResult Maven / Gradle / Ivy
package io.magentys.java8;
import com.lambdista.util.Try;
import io.magentys.Agent;
public class MissionResult {
private final Try tryable;
private final Agent agent;
public MissionResult(Try tryable, Agent agent) {
this.tryable = tryable;
this.agent = agent;
}
public T andReturns() throws Throwable {
if (tryable.isFailure()) {
throw tryable.failed().get();
}
return tryable.get();
}
public MissionResult andKeepsInMind(final String key) {
agent.keepsInMind(key, tryable.get());
return this;
}
public boolean failed() {
return tryable.isFailure();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy