Example usage for com.google.common.base Preconditions checkState

List of usage examples for com.google.common.base Preconditions checkState

Introduction

In this page you can find the example usage for com.google.common.base Preconditions checkState.

Prototype

public static void checkState(boolean expression) 

Source Link

Document

Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.

Usage

From source file:com.palantir.atlasdb.table.description.render.Renderer.java

protected String render() {
    Preconditions.checkState(s.length() == 0);
    run();
    return s.toString();
}

From source file:io.druid.server.http.HostAndPortWithScheme.java

private static String checkAndGetScheme(String scheme) {
    String schemeLowerCase = StringUtils.toLowerCase(scheme);
    Preconditions.checkState(schemeLowerCase.equals("http") || schemeLowerCase.equals("https"));
    return schemeLowerCase;
}

From source file:org.opendaylight.controller.md.statistics.manager.AbstractListeningStatsTracker.java

public void start(final DataBrokerService dbs) {
    Preconditions.checkState(reg == null);

    reg = dbs.registerDataChangeListener(listenPath(), this);
    logger.debug("{} Statistics tracker for node {} started", statName(), getNodeIdentifier());
}

From source file:com.facebook.buck.util.ChunkAccumulator.java

private void pop() {
    Preconditions.checkState(!chunks.isEmpty());
    String chunk = chunks.remove();
    size -= chunk.getBytes(charset).length;
}

From source file:com.cloudera.impala.analysis.AlterTableStmt.java

protected AlterTableStmt(TableName tableName) {
    Preconditions.checkState(tableName != null && !tableName.isEmpty());
    tableName_ = tableName;
    table_ = null;
}

From source file:com.google.javascript.jscomp.SubstituteEs6Syntax.java

public SubstituteEs6Syntax(AbstractCompiler compiler) {
    Preconditions.checkState(compiler.getOptions().getLanguageOut().isEs6OrHigher());
    this.compiler = compiler;
}

From source file:org.opendaylight.netconf.sal.connect.netconf.listener.UncancellableFuture.java

@Override
public synchronized boolean set(@Nullable final V value) {
    Preconditions.checkState(uncancellable);
    return super.set(value);
}

From source file:org.apache.druid.server.http.HostAndPortWithScheme.java

private static String checkAndGetScheme(String scheme) {
    String schemeLowerCase = StringUtils.toLowerCase(scheme);
    Preconditions.checkState("http".equals(schemeLowerCase) || "https".equals(schemeLowerCase));
    return schemeLowerCase;
}

From source file:com.google.devtools.build.lib.analysis.AliasProvider.java

public AliasProvider(ImmutableList<Label> aliasChain) {
    Preconditions.checkState(!aliasChain.isEmpty());
    this.aliasChain = aliasChain;
}

From source file:org.apache.hadoop.oncrpc.security.CredentialsNone.java

@Override
public void write(XDR xdr) {
    Preconditions.checkState(mCredentialsLength == 0);
    xdr.writeInt(mCredentialsLength);
}