2020-09-29 11:24:49 +00:00
|
|
|
package org.capnproto;
|
|
|
|
|
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
|
|
|
|
|
public class CallContext<Params, Results> {
|
|
|
|
|
2020-09-29 13:08:23 +00:00
|
|
|
private final FromPointerReader<Params> params;
|
|
|
|
private final FromPointerBuilder<Results> results;
|
2020-10-21 20:29:41 +00:00
|
|
|
private final CallContextHook hook;
|
2020-09-29 11:24:49 +00:00
|
|
|
|
2020-10-02 20:27:11 +00:00
|
|
|
public CallContext(FromPointerReader<Params> params,
|
2020-09-29 11:24:49 +00:00
|
|
|
FromPointerBuilder<Results> results,
|
|
|
|
CallContextHook hook) {
|
|
|
|
this.params = params;
|
|
|
|
this.results = results;
|
2020-10-21 20:29:41 +00:00
|
|
|
this.hook = hook;
|
2020-09-29 11:24:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final Params getParams() {
|
2020-10-21 20:29:41 +00:00
|
|
|
return this.hook.getParams().getAs(params);
|
2020-09-29 11:24:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final void releaseParams() {
|
|
|
|
this.hook.releaseParams();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Results getResults() {
|
|
|
|
return this.hook.getResults().getAs(results);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Results initResults() {
|
|
|
|
return this.hook.getResults().initAs(results);
|
|
|
|
}
|
|
|
|
|
2020-10-21 20:37:22 +00:00
|
|
|
public final <SubParams, Results> CompletableFuture<java.lang.Void> tailCall(Request<SubParams, Results> tailRequest) {
|
2020-10-23 18:25:50 +00:00
|
|
|
return this.hook.tailCall(tailRequest.hook);
|
2020-09-29 11:24:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final void allowCancellation() {
|
|
|
|
this.hook.allowCancellation();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final CallContextHook getHook() {
|
|
|
|
return this.hook;
|
|
|
|
}
|
|
|
|
}
|