List of usage examples for java.util Objects requireNonNull
public static <T> T requireNonNull(T obj)
From source file:com.hurence.logisland.util.kura.Metrics.java
public static void buildPayload(final KuraPayloadProto.KuraPayload.Builder builder, final Payload payload) { Objects.requireNonNull(builder); Objects.requireNonNull(payload); buildBody(builder, payload.getBody()); buildPosition(builder, payload.getPosition()); buildMetrics(builder, payload.getMetrics()); }
From source file:com.conwet.silbops.api.impl.XJSPSubEndpoint.java
private static <E> void addNotNull(Set<E> set, E elem) { set.add(Objects.requireNonNull(elem)); }
From source file:org.eclipse.hono.service.registration.BaseRegistrationService.java
/** * Sets the factory to use for creating tokens asserting a device's registration status. * // w w w . j av a 2 s .co m * @param assertionFactory The factory. * @throws NullPointerException if factory is {@code null}. */ @Autowired @Qualifier("signing") public final void setRegistrationAssertionFactory(final RegistrationAssertionHelper assertionFactory) { this.assertionFactory = Objects.requireNonNull(assertionFactory); }
From source file:io.coala.enterprise.persist.FactDao.java
public static FactDao create(final EntityManager em, final Fact fact) { final Transaction<?> tx = Objects.requireNonNull(fact.transaction()); final Date offset = Date.from(tx.offset()); final Unit<?> unit = tx.timeUnit(); final Instant occur = Objects.requireNonNull(fact.occur()); final Instant expire = fact.expire(); final ID causeRef = fact.causeRef(); final FactDao dao = new FactDao(); dao.id = Objects.requireNonNull(fact.id().unwrap()); dao.tid = Objects.requireNonNull(tx.id().unwrap()); dao.type = Objects.requireNonNull(tx.kind()); dao.kind = Objects.requireNonNull(fact.kind()); dao.initiatorRef = Objects.requireNonNull(tx.initiatorRef()).persist(em); dao.executorRef = Objects.requireNonNull(tx.executorRef()).persist(em); dao.creatorRef = Objects.requireNonNull(fact.creatorRef()).persist(em); dao.cause = causeRef == null ? null : find(em, causeRef); dao.causeRef = causeRef == null ? null : Objects.requireNonNull(causeRef.unwrap()); dao.causeTranRef = causeRef == null ? null : Objects.requireNonNull(causeRef.parentRef()).unwrap(); dao.occur = InstantDao.of(occur, offset, unit); dao.expire = InstantDao.of(expire, offset, unit); dao.properties = JsonUtil.toTree(fact.properties()); // em.persist( result ); return dao;/*from w ww .j a v a 2 s . co m*/ }
From source file:io.coala.bind.persist.LocalIdDao.java
public static LocalIdDao create(final EntityManager em, final LocalId id) { final Comparable<?> value = Objects.requireNonNull(id.unwrap()); final LocalIdDao parentRef = Objects.requireNonNull(id.parentRef()).parentRef() == null ? null : id.parentRef().persist(em); final UUID contextRef = Objects.requireNonNull(id.contextRef()); final LocalIdDao result = new LocalIdDao(); result.contextRef = contextRef;//from www .ja v a 2s.c om result.parentRef = parentRef; result.value = value.toString(); // em.persist( result ); return result; }
From source file:com.bodybuilding.argos.discovery.ConfigurationClusterDiscovery.java
public void setServers(List<String> servers) { Objects.requireNonNull(servers); this.servers = servers; }
From source file:com.ait.tooling.server.core.json.binder.JSONBinder.java
@Override public void send(final Writer writer, final Object object) throws ParserException { Objects.requireNonNull(object); try {/*w w w .j a v a 2s. c o m*/ if (object instanceof JSONObject) { ((JSONObject) object).writeJSONString(writer, isStrict()); } else { super.send(writer, object); } } catch (Exception e) { throw new ParserException(e); } }
From source file:org.eclipse.hono.service.http.HttpServiceBase.java
/** * Adds an endpoint to this server./* w ww.j a v a 2 s . c o m*/ * * @param ep The endpoint. */ public final void addEndpoint(final HttpEndpoint ep) { LOG.debug("registering endpoint [{}]", ep.getName()); endpoints.add(Objects.requireNonNull(ep)); }
From source file:org.eclipse.hono.service.http.AbstractHttpEndpoint.java
/** * Sets configuration properties./*from w w w . j a va 2 s . c o m*/ * * @param props The properties. * @throws NullPointerException if props is {@code null}. */ @Qualifier(Constants.QUALIFIER_REST) @Autowired(required = false) public final void setConfiguration(final T props) { this.config = Objects.requireNonNull(props); }
From source file:com.ejisto.core.classloading.decorator.MockedFieldDecorator.java
public static MockedFieldDecorator copyOf(MockedField source) { Objects.requireNonNull(source); return new MockedFieldDecorator(MockedFieldImpl.copyOf((MockedFieldImpl) source.unwrap())); }