List of usage examples for java.util Objects requireNonNull
public static <T> T requireNonNull(T obj)
From source file:com.buildria.mocking.serializer.JacksonJsonSerializer.java
@Override public <T> T deserialize(InputStream src, Class<T> type) throws IOException { Objects.requireNonNull(src); Objects.requireNonNull(type); ObjectMapper mapper = new ObjectMapper(); try (InputStreamReader is = new InputStreamReader(src, ctx.getCharset())) { return mapper.readValue(is, type); }//from ww w . ja v a 2 s . c o m }
From source file:org.ow2.proactive_grid_cloud_portal.cli.cmd.sched.SubmitJobCommand.java
public SubmitJobCommand(String... params) throws NullPointerException { Objects.requireNonNull(params); this.pathname = params[0]; if (params.length > 1) { this.variables = params[1]; }/*from ww w . j av a2 s. co m*/ this.jobKeyValueTransformer = new JobKeyValueTransformer(); }
From source file:com.conwet.silbops.msg.UnsubscribeMsg.java
public void setUncovered(Set<Subscription> uncovered) { this.uncovered = Objects.requireNonNull(uncovered); }
From source file:io.github.retz.web.JobRequestHandler.java
static String listJob(spark.Request req, spark.Response res) throws IOException { Optional<AuthHeader> authHeaderValue = WebConsole.getAuthInfo(req); LOG.debug("list jobs owned by {}", authHeaderValue.get().key()); ListJobRequest listJobRequest = MAPPER.readValue(req.body(), ListJobRequest.class); LOG.debug("q: state={}, tag={}", listJobRequest.state(), listJobRequest.tag()); String user = Objects.requireNonNull(authHeaderValue.get().key()); try {//from w ww . ja v a 2s . c om List<Job> jobs = JobQueue.list(user, listJobRequest.state(), listJobRequest.tag(), MAX_LIST_JOB_SIZE); boolean more = false; if (jobs.size() > ListJobResponse.MAX_JOB_NUMBER) { more = true; jobs = jobs.subList(0, ListJobResponse.MAX_JOB_NUMBER); } ListJobResponse listJobResponse = new ListJobResponse(jobs, more); listJobResponse.ok(); res.status(200); res.type("application/json"); return MAPPER.writeValueAsString(listJobResponse); } catch (SQLException e) { LOG.error(e.toString(), e); res.status(500); return "\"Internal Error\""; } }
From source file:com.conwet.silbops.msg.ContextMsg.java
public void setContext(Context context) { this.context = Objects.requireNonNull(context); }
From source file:com.joyent.manta.util.ContinuingInputStream.java
/** * Construct a new stream that reads from {@code initial} and can handle continuations and the lifecycle of both. * * @param initial the stream from which to start reading */// w w w . j a v a 2 s . c o m public ContinuingInputStream(final InputStream initial) { this.eofSeen = false; this.closed = false; this.bytesRead = 0; this.wrapped = Objects.requireNonNull(initial); }
From source file:at.gridtec.lambda4j.consumer.bi.BiConsumer2.java
/** * Calls the given {@link BiConsumer} 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 consumer The consumer to be called * @param t The first argument to the consumer * @param u The second argument to the consumer * @throws NullPointerException If given argument is {@code null} */// w w w . j a v a 2 s . c om static <T, U> void call(@Nonnull final BiConsumer<? super T, ? super U> consumer, T t, U u) { Objects.requireNonNull(consumer); consumer.accept(t, u); }
From source file:com.github.horrorho.inflatabledonkey.DownloadAssistant.java
public DownloadAssistant(Function<Set<Asset>, List<Set<Asset>>> batchFunction, KeyBagManager keyBagManager, ForkJoinPool forkJoinPool, Optional<ForkJoinPool> forkJoinPoolAux, Donkey donkey, Path folder) { this.batchFunction = Objects.requireNonNull(batchFunction); this.keyBagManager = Objects.requireNonNull(keyBagManager); this.forkJoinPool = Objects.requireNonNull(forkJoinPool); this.forkJoinPoolAux = Objects.requireNonNull(forkJoinPoolAux); this.donkey = Objects.requireNonNull(donkey); this.folder = Objects.requireNonNull(folder); }
From source file:com.github.horrorho.liquiddonkey.cloud.HttpAgent.java
HttpAgent(HttpClient client, int retryCount, int retryDelayMs, Authenticator authenticator) { this.client = Objects.requireNonNull(client); this.retryCount = retryCount; this.retryDelayMs = retryDelayMs; this.authenticator = Objects.requireNonNull(authenticator); }
From source file:com.github.horrorho.inflatabledonkey.responsehandler.HeaderResponseHandler.java
HeaderResponseHandler(ResponseHandler<T> responseHandler, Map<String, List<Header>> headers, Locale locale, ProtocolVersion protocolVersion, StatusLine statusLine) { this.responseHandler = Objects.requireNonNull(responseHandler); this.headers = headers; this.locale = locale; this.protocolVersion = protocolVersion; this.statusLine = statusLine; }