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, Supplier<String> messageSupplier) 

Source Link

Document

Checks that the specified object reference is not null and throws a customized NullPointerException if it is.

Usage

From source file:com.navercorp.pinpoint.flink.dao.hbase.ResponseTimeDao.java

public ResponseTimeDao(HbaseTemplate2 hbaseTemplate2,
        ApplicationStatHbaseOperationFactory applicationStatHbaseOperationFactory,
        ResponseTimeSerializer responseTimeSerializer, TableNameProvider tableNameProvider) {
    this.hbaseTemplate2 = Objects.requireNonNull(hbaseTemplate2, "hbaseTemplate2 must not be null");
    this.applicationStatHbaseOperationFactory = Objects.requireNonNull(applicationStatHbaseOperationFactory,
            "applicationStatHbaseOperationFactory must not be null");
    this.responseTimeSerializer = Objects.requireNonNull(responseTimeSerializer,
            "responseTimeSerializer must not be null");
    this.tableNameProvider = Objects.requireNonNull(tableNameProvider, "tableNameProvider must not be null");
}

From source file:com.navercorp.pinpoint.flink.dao.hbase.FileDescriptorDao.java

public FileDescriptorDao(HbaseTemplate2 hbaseTemplate2,
        ApplicationStatHbaseOperationFactory applicationStatHbaseOperationFactory,
        FileDescriptorSerializer fileDescriptorSerializer, TableNameProvider tableNameProvider) {
    this.hbaseTemplate2 = Objects.requireNonNull(hbaseTemplate2, "hbaseTemplate2 must not be null");
    this.applicationStatHbaseOperationFactory = Objects.requireNonNull(applicationStatHbaseOperationFactory,
            "applicationStatHbaseOperationFactory must not be null");
    this.fileDescriptorSerializer = Objects.requireNonNull(fileDescriptorSerializer,
            "fileDescriptorSerializer must not be null");
    this.tableNameProvider = Objects.requireNonNull(tableNameProvider, "tableNameProvider must not be null");
}

From source file:com.netflix.nicobar.manager.explorer.resources.ArchiveRepositoriesResource.java

public ArchiveRepositoriesResource(Map<String, ArchiveRepository> repositories) {
    this.repositories = Objects.requireNonNull(repositories, "repositories");
}

From source file:fr.landel.utils.commons.ArrayUtils.java

/**
 * Search if {@code arrayToSearch} contains all {@code arraySearched}
 * entries.//  ww w. ja  v  a  2 s. co m
 * 
 * @param arrayToSearch
 *            where to search array (required, not null)
 * @param arraySearched
 *            what to search array (required, not null)
 * @param checkType
 *            check if the type is identical from each array
 * @param <T>
 *            The type of element in array to search
 * @param <U>
 *            The type of element in searched array
 * @return true, if all elements were found
 */
public static <T, U> boolean containsAll(final T[] arrayToSearch, final U[] arraySearched,
        final boolean checkType) {
    Objects.requireNonNull(arrayToSearch, "Array to search cannot be null");
    Objects.requireNonNull(arraySearched, "Searched array cannot be null");

    return has(arrayToSearch, arraySearched, true, checkType);
}

From source file:com.conwet.silbops.model.Constraint.java

/**
 * Create a new constraint with the given operator.
 *
 * @param operator Operator/*  ww  w .ja va 2  s  .c  o  m*/
 * @param value Operand whose operator must match the operator
 */
public Constraint(Operator operator, Value value) {

    operator = Objects.requireNonNull(operator, "Operator is null");

    if (!operator.isValidOperand(value)) {

        throw new IllegalArgumentException("Operator " + operator + " isn't compatible with value " + value);
    }

    this.operator = operator; // EXISTS doesn't need a value
    this.value = operator == Operator.EXISTS ? null : value;
}

From source file:com.github.horrorho.inflatabledonkey.protobuf.util.ProtobufParser.java

public ProtobufParser(IOFunction<InputStream, T> parse, Optional<ProtocRawDecoder> decoder) {
    this.parse = Objects.requireNonNull(parse, "parse");
    this.decoder = Objects.requireNonNull(decoder, "decoder");
}

From source file:com.github.xbn.array.helper.AbstractPrimitiveArrayHelper.java

protected final void ciObjNullUnexpectedTypeOrBadIndex(Object obj_supposedToBeArr, int index,
        String array_name) {/*from   w  w  w.  j a  v a  2s. co  m*/
    Objects.requireNonNull(obj_supposedToBeArr, array_name);
    ReflectRtxUtil.crashIfNotAssignableFrom(obj_supposedToBeArr.getClass(), getStaticClass());
    int iLen = getLength(obj_supposedToBeArr, array_name);
    CrashIfIndex.badForLength(index, iLen, "index", "getLength(obj_thatIsPrimArr, ...)");
}

From source file:cn.edu.zjnu.acm.judge.contest.ContestController.java

@SuppressWarnings("ValueOfIncrementOrDecrementUsed")
private <T> void setIndexes(T[] standings, Comparator<T> c, ObjIntConsumer<T> consumer) {
    Objects.requireNonNull(standings, "standings");
    Objects.requireNonNull(c, "c");
    Objects.requireNonNull(consumer, "consumer");
    int i = 0, len = standings.length, lastIndex = 0;

    for (T last = null, standing; i < len; last = standing) {
        standing = standings[i++];/*from  w ww  . ja va2  s .c  om*/
        if (c.compare(standing, last) != 0) {
            lastIndex = i;
        }
        consumer.accept(standing, lastIndex);
    }
}

From source file:com.github.kpavlov.ssl.DynamicSSLSocketFactory.java

public DynamicSSLSocketFactory(KeyStoreProvider keyStoreProvider, KeyPasswordProvider keyPasswordProvider) {
    Objects.requireNonNull(keyStoreProvider, "KeyStoreProvider is required");
    Objects.requireNonNull(keyPasswordProvider, "KeyPasswordProvider is required");
    this.keyPasswordProvider = keyPasswordProvider;
    this.keyStoreProvider = keyStoreProvider;

    SSLSocketFactory systemDefaultFactory = SSLContexts.createSystemDefault().getSocketFactory();
    defaultCipherSuites = systemDefaultFactory.getDefaultCipherSuites();
    supportedCipherSuites = systemDefaultFactory.getSupportedCipherSuites();
}

From source file:org.eclipse.rdf4j.http.client.SharedHttpClientSessionManager.java

public SharedHttpClientSessionManager(CloseableHttpClient dependentClient,
        ExecutorService dependentExecutorService) {
    this.httpClient = this.dependentClient = Objects.requireNonNull(dependentClient, "HTTP client was null");
    this.executor = Objects.requireNonNull(dependentExecutorService, "Executor service was null");
}