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:it.unibo.alchemist.language.protelis.DotOperator.java

/**
 * @param name function (or method) name
 * @param target Protelis sub-program that annotates itself with the target of this call
 * @param args arguments of the function
 *///from   ww w  .jav  a2 s .c o  m
public DotOperator(final String name, final AnnotatedTree<?> target, final List<AnnotatedTree<?>> args) {
    super(args);
    Objects.requireNonNull(name);
    isApply = name.equals("apply");
    methodName = name;
    left = target;
}

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

public void readJournalListFromResource(String resourceFileName) {
    URL url = Objects.requireNonNull(
            JournalAbbreviationRepository.class.getResource(Objects.requireNonNull(resourceFileName)));
    try {//www . j a  v  a 2s  . com
        readJournalList(new InputStreamReader(url.openStream(), StandardCharsets.UTF_8));
    } catch (IOException e) {
        LOGGER.info("Could not read journal list from file " + resourceFileName, e);
    }
}

From source file:com.bodybuilding.argos.controller.TurbineStreamController.java

@Autowired
public TurbineStreamController(ClusterRegistry clusterRegistry, Observable<Boolean> shutdown) {
    this.clusterRegistry = Objects.requireNonNull(clusterRegistry);
    this.shutdown = Objects.requireNonNull(shutdown);
}

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

@Override
public boolean testSignature(final String text, final String value) {
    return Objects.requireNonNull(value).equals(hmac(Objects.requireNonNull(text)));
}

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

public static boolean exists(final EntityManager em, final ID id) {
    final UUID uuid = Objects.requireNonNull(id.unwrap());
    try {/*from w w  w. j av  a2 s. c  om*/
        //         final Integer pk = 
        em.createQuery("SELECT d.pk FROM " + ENTITY_NAME + " d WHERE d.id=?1", Integer.class)
                .setParameter(1, uuid).getSingleResult();
        return true;
    } catch (final NoResultException ignore) {
        return false;
    }
}

From source file:com.bodybuilding.argos.controller.StreamController.java

@Autowired
public StreamController(ClusterRegistry registry, Observable<Boolean> shutdown) {
    Objects.requireNonNull(registry);
    Objects.requireNonNull(shutdown);
    ObjectMapper om = new ObjectMapper();
    om.enable(MapperFeature.AUTO_DETECT_FIELDS);
    om.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
    om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);

    Observable<HystrixClusterMetrics> metricsObs = registry.observe();

    streamObservable = metricsObs.takeUntil(shutdown).map(d -> {
        try {/*from w w  w.  j  a v  a 2  s .com*/
            return om.writeValueAsString(d);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
    }).share();
}

From source file:nu.yona.server.messaging.service.SenderInfo.java

private SenderInfo(Optional<UserDto> user, String nickname, Optional<UUID> userPhotoId, boolean isBuddy,
        Optional<BuddyDto> buddy) {
    this.user = Objects.requireNonNull(user);
    this.nickname = nickname;
    this.userPhotoId = Objects.requireNonNull(userPhotoId);
    this.isBuddy = isBuddy;
    this.buddy = Objects.requireNonNull(buddy);
}

From source file:io.github.retz.admin.AdminConsoleClient.java

public AdminConsoleClient(JmxClient client) throws MalformedObjectNameException {
    this.client = Objects.requireNonNull(client);
    objectName = new ObjectName("io.github.retz.scheduler:type=AdminConsole");
    this.mapper = new ObjectMapper();
    this.mapper.registerModule(new Jdk8Module());
}

From source file:com.github.horrorho.inflatabledonkey.responsehandler.InputStreamResponseHandler.java

public InputStreamResponseHandler(IOFunction<InputStream, T> function) {
    this.function = Objects.requireNonNull(function);
}

From source file:onl.area51.httpd.action.HttpFunction.java

default <V> HttpFunction<T, V> andThen(HttpFunction<? super R, ? extends V> after) {
    Objects.requireNonNull(after);
    return (T t) -> after.apply(apply(t));
}