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.e2.bw.servicereg.model.Organization.java

/** Copies this organization into the other */
public Organization copyTo(Organization org) {
    Objects.requireNonNull(org);
    org.setOrganizationId(organizationId);
    org.setName(name);//www.  j av  a2 s. c  o m
    org.setSummary(summary);
    org.setUrl(url);
    org.setCountry(country);
    org.setLogo(logo);
    return org;
}

From source file:com.spotify.apollo.entity.JacksonEntityCodec.java

private JacksonEntityCodec(ObjectMapper objectMapper) {
    this.objectMapper = Objects.requireNonNull(objectMapper);
}

From source file:org.truelicense.v2.json.codec.JsonCodec.java

/**
 * Constructs a new JSON codec.//from   w  w w  .  j a  v a 2s.  co  m
 *
 * @param mapper the object mapper.
 */
public JsonCodec(final ObjectMapper mapper) {
    this.mapper = Objects.requireNonNull(mapper);
}

From source file:cn.codepub.redis.directory.io.InputOutputStream.java

default String[] getAllFileNames(String directoryMedata) {
    Objects.requireNonNull(directoryMedata);
    Set<byte[]> hkeys = hkeys(directoryMedata.getBytes());
    Objects.requireNonNull(hkeys);
    ArrayList<String> names = Lists.newArrayList();
    hkeys.forEach(key -> names.add(new String(key, StandardCharsets.UTF_8)));
    return names.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
}

From source file:io.github.retz.protocol.data.User.java

@JsonCreator
public User(@JsonProperty(value = "key_id", required = true) String keyId,
        @JsonProperty(value = "secret", required = true) String secret,
        @JsonProperty(value = "enabled", required = true) boolean enabled) {
    this.keyId = Objects.requireNonNull(keyId);
    this.secret = Objects.requireNonNull(secret);
    this.enabled = enabled;
}

From source file:io.github.retz.protocol.GetJobResponse.java

@JsonCreator
public GetJobResponse(@JsonProperty("job") Optional<Job> job) {
    this.job = Objects.requireNonNull(job);
}

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

/**
 * @param client The client for accessing the Tenant service.
 *///  ww w  .j  av a 2s . co  m
public TenantApiTrustOptions(@Autowired final HonoClient client) {
    this(new HonoTrustManagerFactory(new TenantApiBasedX509TrustManager(Objects.requireNonNull(client))));
}

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

public SimpleKeyStringSigningProvider(final String sign) {
    try {/* w  w w . j  av a2  s . co m*/
        m_secret = new SecretKeySpec(Objects.requireNonNull(sign).getBytes(IHTTPConstants.CHARSET_UTF_8),
                HMAC_ALGORITHM);
    } catch (Exception e) {
        logger.error("hmac error", e);

        throw new IllegalArgumentException(e);
    }
}

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

/**
 * Returns an entity to function result response handler.
 *
 * @param <R> the function return type, not null
 * @param function the function to apply to the response entity, not null
 * @return an entity to function result response handler, not null
 *//*  w  w  w.j a  va  2 s  . c  o  m*/
public static <R> ResponseHandler<R> of(IOFunction<InputStream, R> function) {
    Objects.requireNonNull(function);

    return new AbstractResponseHandler<R>() {

        @Override
        public R handleEntity(HttpEntity entity) throws IOException {
            try (InputStream inputStream = entity.getContent()) {
                return function.apply(inputStream);
            }
        }
    };
}

From source file:com.asakusafw.testdriver.compiler.util.DeploymentUtil.java

/**
 * Deploys an artifact onto the directory.
 * @param source the source file/directory
 * @param destination the target path//from ww  w  .ja va  2  s  . co  m
 * @param options the deployment options
 * @throws IOException if I/O error was occurred
 */
public static void deploy(File source, File destination, DeployOption... options) throws IOException {
    Objects.requireNonNull(source);
    Objects.requireNonNull(destination);
    Objects.requireNonNull(options);
    Set<DeployOption> opts = EnumSet.noneOf(DeployOption.class);
    Collections.addAll(opts, options);
    if (opts.contains(DeployOption.DELETE_SOURCE)) {
        move(source, destination);
    } else {
        copy(source, destination);
    }
}