Example usage for java.util Objects requireNonNull

List of usage examples for java.util Objects requireNonNull

Introduction

In this page you can find the example usage for java.util Objects requireNonNull.

Prototype

public static <T> T requireNonNull(T obj) 

Source Link

Document

Checks that the specified object reference is not null .

Usage

From source file:at.gridtec.lambda4j.consumer.tri.TriConsumer.java

/**
 * Calls the given {@link TriConsumer} with the given arguments and returns its result.
 *
 * @param <T> The type of the first argument to the consumer
 * @param <U> The type of the second argument to the consumer
 * @param <V> The type of the third argument to the consumer
 * @param consumer The consumer to be called
 * @param t The first argument to the consumer
 * @param u The second argument to the consumer
 * @param v The third argument to the consumer
 * @throws NullPointerException If given argument is {@code null}
 *//* ww w . j  a  va2  s  . com*/
static <T, U, V> void call(@Nonnull final TriConsumer<? super T, ? super U, ? super V> consumer, T t, U u,
        V v) {
    Objects.requireNonNull(consumer);
    consumer.accept(t, u, v);
}

From source file:com.github.horrorho.inflatabledonkey.cloud.Donkey.java

public Donkey(ChunkClient chunkClient, ChunkStore store, int fragmentationThreshold) {
    this.chunkClient = Objects.requireNonNull(chunkClient);
    this.store = Objects.requireNonNull(store);
    this.fragmentationThreshold = fragmentationThreshold;
}

From source file:com.ejisto.core.classloading.decorator.MockedFieldDecorator.java

public static MockedFieldDecorator from(MockedField source) {
    Objects.requireNonNull(source);
    if (source instanceof MockedFieldDecorator) {
        return (MockedFieldDecorator) source;
    }// w  w w.  jav  a  2 s.com
    return new MockedFieldDecorator((MockedFieldImpl) source);
}

From source file:com.github.horrorho.liquiddonkey.cloud.engine.Donkey.java

Donkey(HttpAgent agent, ChunksClient chunksClient, ChunkManager storeManager, SignatureManager signatureManager,
        int retryCount, AtomicReference<HttpUriRequest> request) {

    this.agent = Objects.requireNonNull(agent);
    this.chunksClient = Objects.requireNonNull(chunksClient);
    this.storeManager = Objects.requireNonNull(storeManager);
    this.signatureManager = Objects.requireNonNull(signatureManager);
    this.retryCount = retryCount;
    this.request = request;
}

From source file:net.e2.bw.idreg.client.keycloak.KeycloakClient.java

/**
 * Constructor/* w  w  w  . j  a v a  2s. c  o  m*/
 * @param config the configuration
 * @param customClaims optionally, a list of custom claims
 */
private KeycloakClient(KeycloakJsonConfig config, String[] customClaims) {
    this.config = Objects.requireNonNull(config);
    this.customClaims = customClaims;
}

From source file:it.unibo.alchemist.model.implementations.actions.LsaStandardAction.java

/**
 * Builds a new local action./*  w  w w  .  j a v a 2 s.com*/
 * 
 * @param n
 *            The source node
 * @param m
 *            The ILsaMolecule instance you want to add to the node lsa
 *            space.
 * @param random
 *            The Random generator to use
 */
public LsaStandardAction(final ILsaMolecule m, final ILsaNode n, final RandomGenerator random) {
    super(n, Arrays.asList(new ILsaMolecule[] { m }));
    mol = Objects.requireNonNull(m);
    rand = random;
    final String molString = mol.toString();
    initRand = molString.contains(SYN_RAND);
    initNode = molString.contains(SYN_NODE_ID);
    if (initRand && random == null) {
        L.warn(SYN_RAND + " is used in " + m
                + ", but the RandomGenerator has not been initialized. You know this WILL lead to problems, don't you?");
    }
    nodeId = initNode ? new ConstTreeNode(new HashString("node" + n.getId())) : null;
}

From source file:org.eclipse.hono.service.auth.delegating.DelegatingAuthenticationService.java

/**
 * Sets the factory to use for connecting to the authentication server.
 * /*from  w  w w . ja  v a 2s  .  c  o  m*/
 * @param connectionFactory The factory.
 * @throws NullPointerException if the factory is {@code null}.
 */
@Autowired
public void setConnectionFactory(
        @Qualifier(AuthenticationConstants.QUALIFIER_AUTHENTICATION) final ConnectionFactory connectionFactory) {
    this.factory = Objects.requireNonNull(connectionFactory);
}

From source file:org.trustedanalytics.uploader.service.UploadService.java

@Autowired
public UploadService(Function<InputStream, InputStream> streamDecoder,
        TriConsumer<InputStream, Transfer, UUID> streamConsumer, DataAcquisitionClient client,
        Function<Authentication, String> tokenExtractor) {
    this.streamDecoder = streamDecoder;
    this.streamConsumer = streamConsumer;
    this.dataAcquisitionClient = Objects.requireNonNull(client);
    this.tokenExtractor = Objects.requireNonNull(tokenExtractor);
}

From source file:com.cloudera.oryx.app.serving.AbstractOryxResource.java

protected final ServingModel getServingModel() throws OryxServingException {
    ServingModel servingModel = getServingModelManager().getModel();
    if (hasLoadedEnough) {
        Objects.requireNonNull(servingModel);
        return servingModel;
    }//from   w  ww.j a va  2 s.  c o m
    if (servingModel != null) {
        double minModelLoadFraction = getServingModelManager().getConfig()
                .getDouble("oryx.serving.min-model-load-fraction");
        Preconditions.checkArgument(minModelLoadFraction >= 0.0 && minModelLoadFraction <= 1.0);
        float fractionLoaded = servingModel.getFractionLoaded();
        log.info("Model loaded fraction: {}", fractionLoaded);
        if (fractionLoaded >= minModelLoadFraction) {
            hasLoadedEnough = true;
        }
    }
    if (hasLoadedEnough) {
        Objects.requireNonNull(servingModel);
        return servingModel;
    } else {
        throw new OryxServingException(Response.Status.SERVICE_UNAVAILABLE);
    }
}

From source file:org.eclipse.hono.service.auth.device.CredentialsApiAuthProvider.java

/**
 * Sets the client to use for connecting to the Credentials service.
 *
 * @param credentialsServiceClient The client.
 * @throws NullPointerException if the client is {@code null}.
 *//*from  w  w w .  j av a 2  s.  c  o m*/
@Qualifier(CredentialsConstants.CREDENTIALS_ENDPOINT)
@Autowired
public final void setCredentialsServiceClient(final HonoClient credentialsServiceClient) {
    this.credentialsClient = Objects.requireNonNull(credentialsServiceClient);
}