Move NULL and BROKEN brands to ClientHook
This commit is contained in:
parent
59701de848
commit
4171577bf0
2 changed files with 7 additions and 5 deletions
|
@ -5,10 +5,10 @@ import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.CompletionStage;
|
import java.util.concurrent.CompletionStage;
|
||||||
|
|
||||||
public final class Capability {
|
import static org.capnproto.ClientHook.BROKEN_CAPABILITY_BRAND;
|
||||||
|
import static org.capnproto.ClientHook.NULL_CAPABILITY_BRAND;
|
||||||
|
|
||||||
static final Object NULL_CAPABILITY_BRAND = new Object();
|
public final class Capability {
|
||||||
static final Object BROKEN_CAPABILITY_BRAND = new Object();
|
|
||||||
|
|
||||||
public static class BuilderContext {
|
public static class BuilderContext {
|
||||||
public CapTableBuilder capTable;
|
public CapTableBuilder capTable;
|
||||||
|
|
|
@ -5,6 +5,8 @@ import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
public interface ClientHook {
|
public interface ClientHook {
|
||||||
|
|
||||||
|
static final Object NULL_CAPABILITY_BRAND = new Object();
|
||||||
|
static final Object BROKEN_CAPABILITY_BRAND = new Object();
|
||||||
/**
|
/**
|
||||||
* Start a new call, allowing the client to allocate request/response objects as it sees fit.
|
* Start a new call, allowing the client to allocate request/response objects as it sees fit.
|
||||||
* This version is used when calls are made from application code in the local process.
|
* This version is used when calls are made from application code in the local process.
|
||||||
|
@ -70,14 +72,14 @@ public interface ClientHook {
|
||||||
* reading a null pointer out of a Cap'n Proto message.
|
* reading a null pointer out of a Cap'n Proto message.
|
||||||
*/
|
*/
|
||||||
default boolean isNull() {
|
default boolean isNull() {
|
||||||
return getBrand() == Capability.NULL_CAPABILITY_BRAND;
|
return getBrand() == NULL_CAPABILITY_BRAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the capability was created by newBrokenCap().
|
* Returns true if the capability was created by newBrokenCap().
|
||||||
*/
|
*/
|
||||||
default boolean isError() {
|
default boolean isError() {
|
||||||
return getBrand() == Capability.BROKEN_CAPABILITY_BRAND;
|
return getBrand() == BROKEN_CAPABILITY_BRAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue