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.maritimecloud.identityregistry.model.database.Logo.java

/** Copies this user into the other */
public Logo copyTo(Logo logo) {
    Objects.requireNonNull(logo);
    logo.setId(id);/*from   w  w w .j  a  v a2s. com*/
    logo.setOrganization(organization);
    logo.setImage(image);
    return logo;
}

From source file:org.eclipse.hono.server.SenderFactoryImpl.java

@Override
public Future<ProtonSender> createSender(final ProtonConnection connection, final String address,
        final ProtonQoS qos, final Handler<ProtonSender> sendQueueDrainHandler) {

    Objects.requireNonNull(connection);
    Objects.requireNonNull(address);
    Objects.requireNonNull(qos);//from   w  w w .  j ava2  s  . c  o m

    if (connection.isDisconnected()) {
        return Future.failedFuture("connection is disconnected");
    } else {
        return newSession(connection).compose(session -> {
            return newSender(connection, session, address, qos, sendQueueDrainHandler);
        });
    }
}

From source file:com.spotify.hamcrest.jackson.IsJsonText.java

private IsJsonText(final Matcher<? super String> textMatcher) {
    super(JsonNodeType.STRING);
    this.textMatcher = Objects.requireNonNull(textMatcher);
}

From source file:io.github.moosbusch.lumpi.gui.impl.SelectionAdapter.java

public SelectionAdapter(Component eventSource, T value, String expr) {
    this.eventSourceRef = new WeakReference<>(Objects.requireNonNull(eventSource));
    this.data = new Dictionary.Pair<>(new Expression(expr), new WeakReference<>(Objects.requireNonNull(value)));
}

From source file:com.gs.obevo.db.api.appdata.ServerDirectory.java

public ServerDirectory(String name, String directoryPath) {
    this.name = Objects.requireNonNull(name);
    this.directoryPath = Objects.requireNonNull(directoryPath);
}

From source file:org.dswarm.common.types.Tuple.java

@JsonCreator
public Tuple(@JsonProperty("v1") final V1 v1, @JsonProperty("v2") final V2 v2) {

    this.v1 = Objects.requireNonNull(v1);
    this.v2 = Objects.requireNonNull(v2);
}

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

@Override
public String sha512(final String text) {
    Objects.requireNonNull(text);

    MessageDigest md;/* ww  w. ja v a2  s .co m*/

    try {
        md = MessageDigest.getInstance("SHA-512");
    } catch (Exception e) {
        logger.error("No SHA-512 Algorithm ", e);

        throw new IllegalArgumentException(e);
    }
    byte[] bytes;

    try {
        bytes = text.getBytes(IHTTPConstants.CHARSET_UTF_8);
    } catch (Exception e) {
        logger.error("No " + IHTTPConstants.CHARSET_UTF_8 + " encoding ", e);

        throw new IllegalArgumentException(e);
    }
    md.update(bytes);

    return Hex.encodeHexString(md.digest());
}

From source file:com.spotify.hamcrest.jackson.IsJsonBoolean.java

private IsJsonBoolean(Matcher<? super Boolean> booleanMatcher) {
    super(JsonNodeType.BOOLEAN);
    this.booleanMatcher = Objects.requireNonNull(booleanMatcher);
}

From source file:com.javacreed.examples.akka.internal.GreetingActor.java

@Autowired
public GreetingActor(final GreetingService greetingService) {
    this.greetingService = Objects.requireNonNull(greetingService);
}

From source file:org.eclipse.hono.util.ConfigurationSupportingVerticle.java

/**
 * Sets the properties to use for configuring the sockets to listen on.
 * /* w w w .  j a  v a 2 s .co m*/
 * @param props The properties.
 * @throws NullPointerException if props is {@code null}.
 */
@Autowired(required = false)
public final void setConfig(final T props) {
    this.config = Objects.requireNonNull(props);
}