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:org.opendaylight.protocol.pcep.spi.pojo.AbstractPCEPExtensionProviderActivator.java

@Override
public final synchronized void start(final PCEPExtensionProviderContext context) {
    Preconditions.checkState(this.registrations == null);

    this.registrations = Preconditions.checkNotNull(startImpl(context));
}

From source file:org.b1.pack.standard.reader.LzmaDecoder.java

public void init(byte[] properties) {
    decoder = new Decoder();
    Preconditions.checkState(decoder.SetDecoderProperties(properties));
}

From source file:org.locationtech.geogig.api.plumbing.CatObject.java

@Override
protected CharSequence _call() {
    Preconditions.checkState(object != null);
    RevObject revObject = object.get();//from  w  w w  .j a  v a  2  s .c om

    TextSerializationFactory serializer = TextSerializationFactory.INSTANCE;
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    String s = "id\t" + revObject.getId().toString() + "\n";
    OutputStreamWriter streamWriter = new OutputStreamWriter(output, Charsets.UTF_8);
    try {
        streamWriter.write(s);
        streamWriter.flush();
        serializer.write(revObject, output);
    } catch (IOException e) {
        throw new IllegalStateException("Cannot print object: " + revObject.getId().toString(), e);
    }
    return output.toString();
}

From source file:org.haiku.haikudepotserver.repository.model.RepositoryHpkrIngressJobSpecification.java

public RepositoryHpkrIngressJobSpecification(String repositoryCode, Set<String> repositorySourceCodes) {
    this();/*from   w  w w. ja va  2 s.  c  om*/
    Preconditions.checkNotNull(repositoryCode);
    Preconditions.checkState(!Strings.isNullOrEmpty(repositoryCode));
    this.repositoryCode = repositoryCode;
    this.repositorySourceCodes = repositorySourceCodes;
}

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

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

From source file:com.cloudera.impala.authorization.AuthorizeableServer.java

public AuthorizeableServer(String serverName) {
    Preconditions.checkState(!Strings.isNullOrEmpty(serverName));
    server_ = new org.apache.sentry.core.Server(serverName);
}

From source file:org.opendaylight.protocol.bmp.spi.registry.AbstractBmpExtensionProviderActivator.java

@Override
public final synchronized void start(@Nonnull final BmpExtensionProviderContext context) {
    Preconditions.checkState(this.registrations == null);
    this.registrations = Preconditions.checkNotNull(startImpl(context));
}

From source file:com.minlia.cloud.framework.common.persistence.event.AfterEntityDeleteEvent.java

public AfterEntityDeleteEvent(final Object sourceToSet, final Class<T> clazzToSet, final T entityToSet) {
    super(sourceToSet);

    Preconditions.checkState(clazzToSet != null);
    clazz = clazzToSet;/*  ww w.j ava  2  s  .  c  om*/

    Preconditions.checkState(entityToSet != null);
    entity = entityToSet;
}

From source file:com.minlia.cloud.framework.common.persistence.event.BeforeEntityDeleteEvent.java

public BeforeEntityDeleteEvent(final Object sourceToSet, final Class<T> clazzToSet, final T entityToSet) {
    super(sourceToSet);

    Preconditions.checkState(clazzToSet != null);
    clazz = clazzToSet;/*  w  w  w .j  a  va2 s .  c  o  m*/

    Preconditions.checkState(entityToSet != null);
    entity = entityToSet;
}

From source file:dagger.internal.codegen.DaggerStatistics.java

void processingStopped() {
    Preconditions.checkState(totalRuntimeStopwatch.isRunning());
    totalRuntimeStopwatch.stop();

}