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:net.sf.jabref.logic.journals.JournalAbbreviationRepository.java

/**
 * Attempts to get the abbreviated name of the journal given. May contain dots.
 *
 * @param journalName The journal name to abbreviate.
 * @return The abbreviated name//  ww  w  . j  a va 2 s  .  co  m
 */
public Optional<Abbreviation> getAbbreviation(String journalName) {
    String nameKey = Objects.requireNonNull(journalName).toLowerCase(Locale.ENGLISH).trim();

    if (fullNameLowerCase2Abbreviation.containsKey(nameKey)) {
        return Optional.of(fullNameLowerCase2Abbreviation.get(nameKey));
    } else if (isoLowerCase2Abbreviation.containsKey(nameKey)) {
        return Optional.of(isoLowerCase2Abbreviation.get(nameKey));
    } else if (medlineLowerCase2Abbreviation.containsKey(nameKey)) {
        return Optional.of(medlineLowerCase2Abbreviation.get(nameKey));
    } else {
        return Optional.empty();
    }
}

From source file:org.eclipse.hono.client.impl.RegistrationClientImpl.java

/**
 * Gets the AMQP <em>target</em> address to use for sending requests to Hono's Device Registration API endpoint.
 * /*ww w  . j a  va  2  s. com*/
 * @param tenantId The tenant to upload data for.
 * @return The target address.
 * @throws NullPointerException if tenant is {@code null}.
 */
public static final String getTargetAddress(final String tenantId) {
    return String.format("%s/%s", RegistrationConstants.REGISTRATION_ENDPOINT,
            Objects.requireNonNull(tenantId));
}

From source file:org.eclipse.hono.deviceregistry.Application.java

/**
 * Sets the registration service implementation this server is based on.
 *
 * @param registrationService The registrationService to set.
 * @throws NullPointerException if service is {@code null}.
 *//*from  w w  w .  ja  v a  2s.co  m*/
@Autowired
public final void setRegistrationService(final RegistrationService registrationService) {
    this.registrationService = Objects.requireNonNull(registrationService);
}

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

/**
 * Creates an endpoint for a Vertx instance.
 *
 * @param vertx The Vertx instance to use.
 * @throws NullPointerException if vertx is {@code null};
 *//* w w  w.  j  a  v  a  2s .  c  om*/
protected RequestResponseEndpoint(final Vertx vertx) {
    super(Objects.requireNonNull(vertx));
}

From source file:org.eclipse.hono.service.auth.HonoSaslAuthenticatorFactory.java

/**
 * Creates a new factory using a specific authentication service instance.
 * //ww w.  jav a2s. c o m
 * @param authService The object to return on invocations of {@link #create()}.
 * @throws NullPointerException if any of the parameters is {@code null}.
 */
public HonoSaslAuthenticatorFactory(final AuthenticationService authService) {
    this.authenticationService = Objects.requireNonNull(authService);
}

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

BackupClient(ResponseHandler<ICloud.MBSBackup> mbsaBackupResponseHandler,
        ResponseHandler<ICloud.MBSKeySet> mbsaKeySetResponseHandler, Headers headers) {

    this.mbsaBackupResponseHandler = Objects.requireNonNull(mbsaBackupResponseHandler);
    this.mbsaKeySetResponseHandler = Objects.requireNonNull(mbsaKeySetResponseHandler);
    this.headers = Objects.requireNonNull(headers);
}

From source file:com.smoketurner.pipeline.application.core.MessageProcessor.java

/**
 * Constructor/*from  w  w  w.j a  v  a  2s .c  o m*/
 *
 * @param s3
 *            S3 Downloader
 * @param broadcaster
 *            SSE broadcaster
 */
public MessageProcessor(@Nonnull final AmazonS3Downloader s3,
        @Nonnull final InstrumentedSseBroadcaster broadcaster) {
    this.s3 = Objects.requireNonNull(s3);
    this.broadcaster = Objects.requireNonNull(broadcaster);

    final MetricRegistry registry = SharedMetricRegistries.getOrCreate("default");
    this.recordCounts = registry.histogram(name(MessageProcessor.class, "record-counts"));
    this.eventCounts = registry.histogram(name(MessageProcessor.class, "event-counts"));
}

From source file:com.github.horrorho.liquiddonkey.cloud.Authenticator.java

Authenticator(String id, String password, Lock lock, Token token, String invalid) {
    this.id = id;
    this.password = password;
    this.token = token;
    this.lock = Objects.requireNonNull(lock);
    this.invalid = invalid;
}

From source file:com.github.horrorho.liquiddonkey.http.HttpClientFactory.java

HttpClientFactory(HttpConfig config) {
    this.config = Objects.requireNonNull(config);
}

From source file:com.conwet.silbops.msg.AdvertiseMsg.java

public void setContext(Advertise context) {

    this.context = Objects.requireNonNull(context);
}