private ImmutableQueryOptions( @Nullable String wait, @Nullable String token, @Nullable BigInteger index, @Nullable String near, @Nullable String datacenter, ImmutableList<String> nodeMeta, ImmutableList<String> tag, ConsistencyMode consistencyMode) { this.wait = wait; this.token = token; this.index = index; this.near = near; this.datacenter = datacenter; this.nodeMeta = nodeMeta; this.tag = tag; this.consistencyMode = consistencyMode; initShim.consistencyMode(consistencyMode); this.isBlocking = initShim.isBlocking(); this.hasToken = initShim.hasToken(); this.nodeMetaQuery = initShim.getNodeMetaQuery(); this.tagsQuery = initShim.getTagsQuery(); this.initShim = null; }
boolean hasToken() { if (hasTokenStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (hasTokenStage == STAGE_UNINITIALIZED) { hasTokenStage = STAGE_INITIALIZING; this.hasToken = ImmutableQueryOptions.super.hasToken(); hasTokenStage = STAGE_INITIALIZED; } return hasToken; } private List<String> nodeMetaQuery;
private ImmutableQueryOptions(ImmutableQueryOptions.Builder builder) { this.wait = builder.wait; this.token = builder.token; this.index = builder.index; this.near = builder.near; this.datacenter = builder.datacenter; this.nodeMeta = builder.nodeMetaBuilder.build(); this.tag = builder.tagBuilder.build(); if (builder.consistencyMode != null) { initShim.consistencyMode(builder.consistencyMode); } this.consistencyMode = initShim.getConsistencyMode(); this.isBlocking = initShim.isBlocking(); this.hasToken = initShim.hasToken(); this.nodeMetaQuery = initShim.getNodeMetaQuery(); this.tagsQuery = initShim.getTagsQuery(); this.initShim = null; }
/** * @return The computed-at-construction value of the {@code tagsQuery} attribute */ @Override public List<String> getTagsQuery() { return initShim != null ? initShim.getTagsQuery() : tagsQuery; }
/** * @return The computed-at-construction value of the {@code nodeMetaQuery} attribute */ @Override public List<String> getNodeMetaQuery() { return initShim != null ? initShim.getNodeMetaQuery() : nodeMetaQuery; }
/** * @return The computed-at-construction value of the {@code hasToken} attribute */ @Override public boolean hasToken() { return initShim != null ? initShim.hasToken() : hasToken; }
/** * @return The value of the {@code consistencyMode} attribute */ @Override public ConsistencyMode getConsistencyMode() { return initShim != null ? initShim.getConsistencyMode() : consistencyMode; }
List<String> getTagsQuery() { if (tagsQueryStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (tagsQueryStage == STAGE_UNINITIALIZED) { tagsQueryStage = STAGE_INITIALIZING; this.tagsQuery = Preconditions.checkNotNull(ImmutableQueryOptions.super.getTagsQuery(), "tagsQuery"); tagsQueryStage = STAGE_INITIALIZED; } return tagsQuery; }
ConsistencyMode getConsistencyMode() { if (consistencyModeStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (consistencyModeStage == STAGE_UNINITIALIZED) { consistencyModeStage = STAGE_INITIALIZING; this.consistencyMode = Preconditions.checkNotNull(ImmutableQueryOptions.super.getConsistencyMode(), "consistencyMode"); consistencyModeStage = STAGE_INITIALIZED; } return consistencyMode; }
/** * @return The computed-at-construction value of the {@code isBlocking} attribute */ @Override public boolean isBlocking() { return initShim != null ? initShim.isBlocking() : isBlocking; }
boolean isBlocking() { if (isBlockingStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (isBlockingStage == STAGE_UNINITIALIZED) { isBlockingStage = STAGE_INITIALIZING; this.isBlocking = ImmutableQueryOptions.super.isBlocking(); isBlockingStage = STAGE_INITIALIZED; } return isBlocking; } private boolean hasToken;
List<String> getNodeMetaQuery() { if (nodeMetaQueryStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (nodeMetaQueryStage == STAGE_UNINITIALIZED) { nodeMetaQueryStage = STAGE_INITIALIZING; this.nodeMetaQuery = Preconditions.checkNotNull(ImmutableQueryOptions.super.getNodeMetaQuery(), "nodeMetaQuery"); nodeMetaQueryStage = STAGE_INITIALIZED; } return nodeMetaQuery; } private List<String> tagsQuery;