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:org.eclipse.hono.service.registration.RegistrationEndpoint.java

/**
 * Creates a new registration endpoint for a vertx instance.
 * //from w ww.ja  v  a2  s. c om
 * @param vertx The vertx instance to use.
 */
@Autowired
public RegistrationEndpoint(final Vertx vertx) {
    super(Objects.requireNonNull(vertx));
}

From source file:io.coala.enterprise.persist.FactDao.java

public static FactDao find(final EntityManager em, final ID id) {
    final UUID uuid = Objects.requireNonNull(id.unwrap());
    try {/*  w  w w.ja  v a  2  s  .  co m*/
        return em.createQuery("SELECT d FROM " + ENTITY_NAME + " d WHERE d.id=?1", FactDao.class)
                .setParameter(1, uuid).getSingleResult();
    } catch (final NoResultException ignore) {
        return null;
    }
}

From source file:org.eclipse.hono.service.amqp.BaseEndpoint.java

/**
 * Creates an endpoint for a Vertx instance.
 * //ww w  .java 2  s  .  c  o  m
 * @param vertx The Vertx instance to use.
 * @throws NullPointerException if vertx is {@code null};
 */
protected BaseEndpoint(final Vertx vertx) {
    this.vertx = Objects.requireNonNull(vertx);
}

From source file:com.ait.tooling.server.core.security.SimpleSHA512HashProvider.java

@Override
public String sha512(final String text, final String salt, final int iter) {
    return m_hasher.sha512(Objects.requireNonNull(text), Objects.requireNonNull(salt), iter);
}

From source file:net.maritimecloud.identityregistry.model.User.java

/** Copies this organization into the other */
public User copyTo(User user) {
    Objects.requireNonNull(user);
    user.setId(id);//w ww.ja v a  2s  .  c o m
    user.setIdOrganization(idOrganization);
    user.setFirstName(firstName);
    user.setUserOrgId(userOrgId);
    user.setCertificate(certificates);
    return user;
}

From source file:net.sf.jabref.logic.journals.AbbreviationParser.java

public void readJournalListFromFile(File file) throws FileNotFoundException {
    try (FileReader reader = new FileReader(Objects.requireNonNull(file))) {
        readJournalList(reader);/* w  w w.  j a v a  2 s .  c  o  m*/
    } catch (FileNotFoundException e) {
        throw e;
    } catch (IOException e) {
        LOGGER.warn("Could not read journal list from file " + file.getAbsolutePath(), e);
    }
}

From source file:fr.gael.dhus.olingo.v1.map.FunctionalMap.java

/**
 * Creates a FunctionalMap from the given datasource and translierator.
 * @param source data source.//ww  w  .j  a v  a2  s.co m
 * @param visitor transliterator.
 */
public FunctionalMap(Map<K, V> source, FunctionalVisitor visitor) {
    Objects.requireNonNull(source);
    Objects.requireNonNull(visitor);
    sourceMap = source;
    transliterator = visitor;
}

From source file:jgnash.ui.report.compiled.SecurityHighLowChart.java

private static AbstractXYDataset createHighLowDataSet(final SecurityNode node) {
    Objects.requireNonNull(node);

    List<SecurityHistoryNode> hNodes = node.getHistoryNodes();

    int count = hNodes.size();

    Date[] date = new Date[count];
    double[] high = new double[count];
    double[] low = new double[count];
    double[] open = new double[count];
    double[] close = new double[count];
    double[] volume = new double[count];

    for (int i = 0; i < count; i++) {
        final SecurityHistoryNode hNode = hNodes.get(i);

        date[i] = DateUtils.asDate(hNode.getLocalDate());
        high[i] = hNode.getAdjustedHigh().doubleValue();
        low[i] = hNode.getAdjustedLow().doubleValue();
        open[i] = hNode.getAdjustedPrice().doubleValue();
        close[i] = hNode.getAdjustedPrice().doubleValue();
        volume[i] = hNode.getVolume();//from w  ww . j av a 2 s .c  o m
    }

    return new DefaultHighLowDataset(node.getDescription(), date, high, low, open, close, volume);
}

From source file:net.sf.jabref.logic.journals.JournalAbbreviationRepository.java

public boolean isAbbreviatedName(String journalName) {
    String nameKey = Objects.requireNonNull(journalName).trim().toLowerCase(Locale.ENGLISH);
    return (isoLowerCase2Abbreviation.containsKey(nameKey))
            || (medlineLowerCase2Abbreviation.containsKey(nameKey));
}

From source file:com.github.horrorho.liquiddonkey.cloud.client.DataClient.java

DataClient(ResponseHandler<byte[]> byteArrayResponseHandler, Headers headers) {
    this.byteArrayResponseHandler = Objects.requireNonNull(byteArrayResponseHandler);
    this.headers = Objects.requireNonNull(headers);
}