Example usage for com.google.common.base Verify verifyNotNull

List of usage examples for com.google.common.base Verify verifyNotNull

Introduction

In this page you can find the example usage for com.google.common.base Verify verifyNotNull.

Prototype

public static <T> T verifyNotNull(@Nullable T reference) 

Source Link

Document

Ensures that reference is non-null, throwing a VerifyException with a default message otherwise.

Usage

From source file:com.lyndir.lhunath.opal.system.util.NNFunctionNN.java

static <F, T> NNFunctionNN<F, T> of(final Function<F, T> func) {

    return new NNFunctionNN<F, T>() {
        @Nonnull// w  ww.jav  a2  s.c  o m
        @Override
        public T apply(@Nonnull final F input) {

            return Verify.verifyNotNull(func.apply(input));
        }

        @Override
        @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
        public boolean equals(@Nonnull final Object object) {

            return func.equals(object);
        }

        @Override
        public int hashCode() {

            return func.hashCode();
        }
    };
}

From source file:org.opendaylight.controller.cluster.datastore.shardmanager.AtomicShardContextProvider.java

@Override
public SchemaContext getSchemaContext() {
    return Verify.verifyNotNull(get());
}

From source file:org.opendaylight.controller.remote.rpc.registry.gossip.BucketImpl.java

private Object readResolve() {
    Verify.verifyNotNull(data);
    return this;
}

From source file:com.roodie.model.util.ImageHelper.java

public static String getPosterUrl(final MovieWrapper movie, final int width, final int height) {
    String url = null;//from w  w  w .  j  a  v  a 2  s.c o  m

    if (!TextUtils.isEmpty(movie.getPosterUrl())) {
        url = buildTmdbPosterUrl(movie.getPosterUrl(), width, RESIZE_ALL);
    }

    Verify.verifyNotNull(url);

    return RESIZE_ALL ? getResizedUrl(url, width, height) : url;
}

From source file:it.infn.mw.iam.authn.saml.util.NameIdUserIdentifierResolver.java

@Override
public SamlUserIdentifierResolutionResult resolveSamlUserIdentifier(SAMLCredential samlCredential) {

    Verify.verifyNotNull(samlCredential);

    if (samlCredential.getNameID() != null) {
        NameID nameId = samlCredential.getNameID();

        IamSamlId samlId = new IamSamlId();
        samlId.setAttributeId(nameId.getFormat());
        samlId.setUserId(nameId.getValue());
        samlId.setIdpId(samlCredential.getRemoteEntityID());

        return SamlUserIdentifierResolutionResult.resolutionSuccess(samlId);

    }/*from   w  ww  .java 2  s . c  om*/

    return SamlUserIdentifierResolutionResult.resolutionFailure("NameID resolution failure");
}

From source file:org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextWriter.java

@Override
public void startStatement(final int childId, @Nonnull final QName name, final String argument,
        @Nonnull final StatementSourceReference ref) {
    current = Verify.verifyNotNull(ctx.createDeclaredChild(current, childId, name, argument, ref));
}

From source file:org.opendaylight.controller.cluster.access.concepts.AbstractMessageProxy.java

@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
    target = Verify.verifyNotNull(readTarget(in));
}

From source file:org.opendaylight.controller.cluster.access.concepts.AbstractMessageProxy.java

protected final Object readResolve() {
    return Verify.verifyNotNull(createMessage(target));
}

From source file:com.roodie.model.util.ImageHelper.java

public static String getPosterUrl(final ShowWrapper show, final int width, final int height) {
    String url = null;//from  ww  w  . j  ava2s . co  m

    if (!TextUtils.isEmpty(show.getPosterUrl())) {
        url = buildTmdbPosterUrl(show.getPosterUrl(), width, RESIZE_ALL);
    }

    Verify.verifyNotNull(url);

    return RESIZE_ALL ? getResizedUrl(url, width, height) : url;
}

From source file:org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnerChangeListener.java

EntityOwnerChangeListener(final MemberName localMemberName,
        final EntityOwnershipListenerSupport listenerSupport) {
    this.localMemberName = Verify.verifyNotNull(localMemberName.getName());
    this.listenerSupport = Preconditions.checkNotNull(listenerSupport);
}