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.apache.jena.rdfconnection.RDFConnectionRemoteBuilder.java

RDFConnectionRemoteBuilder(RDFConnectionRemote base) {
    Objects.requireNonNull(base);
    txnLifecycle = base.txnLifecycle;//from w  ww  .  j a  v a 2s  .  c o  m
    if (txnLifecycle == null)
        txnLifecycle = TransactionalLock.createMRPlusSW();
    httpClient = base.httpClient;
    httpContext = base.httpContext;
    destination = base.destination;
    sQuery = base.svcQuery;
    sUpdate = base.svcUpdate;
    sGSP = base.svcGraphStore;
    outputQuads = base.outputQuads;
    outputTriples = base.outputTriples;

    acceptGraph = base.acceptGraph;
    acceptDataset = base.acceptDataset;

    acceptSelectResult = base.acceptSelectResult;
    acceptAskResult = base.acceptAskResult;
    parseCheckQueries = base.parseCheckQueries;
    parseCheckUpdates = base.parseCheckUpdates;
}

From source file:com.hurence.logisland.util.kura.Metrics.java

public static void buildPosition(final KuraPayloadProto.KuraPayload.Builder builder, final Position position) {
    if (position == null) {
        return;//from  w  ww  . j  a  va 2 s.co  m
    }

    Objects.requireNonNull(builder);

    final KuraPayloadProto.KuraPayload.KuraPosition.Builder result = KuraPayloadProto.KuraPayload.KuraPosition
            .newBuilder();

    if (position.getAltitude() != null) {
        result.setAltitude(position.getAltitude());
    }

    if (position.getHeading() != null) {
        result.setHeading(position.getHeading());
    }

    if (position.getLatitude() != null) {
        result.setLatitude(position.getLatitude());
    }

    if (position.getLongitude() != null) {
        result.setLongitude(position.getLongitude());
    }

    if (position.getPrecision() != null) {
        result.setPrecision(position.getPrecision());
    }

    if (position.getSatellites() != null) {
        result.setSatellites(position.getSatellites());
    }

    if (position.getSpeed() != null) {
        result.setSpeed(position.getSpeed());
    }

    if (position.getTimestamp() != null) {
        result.setTimestamp(position.getTimestamp().getTime());
    }

    builder.setPosition(result);
}

From source file:at.gridtec.lambda4j.function.bi.BiFunction2.java

/**
 * Lifts a partial {@link BiFunction} into a total {@link BiFunction2} that returns an {@link Optional} result.
 *
 * @param <T> The type of the first argument to the function
 * @param <U> The type of the second argument to the function
 * @param <R> The type of return value from the function
 * @param partial A function that is only defined for some values in its domain
 * @return A partial {@code BiFunction} lifted into a total {@code BiFunction2} that returns an {@code Optional}
 * result./*from  www  .j  a v  a  2  s . c  o m*/
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U, R> BiFunction2<T, U, Optional<R>> lift(
        @Nonnull final BiFunction<? super T, ? super U, ? extends R> partial) {
    Objects.requireNonNull(partial);
    return (t, u) -> Optional.ofNullable(partial.apply(t, u));
}

From source file:com.envision.envservice.service.OrgStructureService.java

/** 
 * (?,,)// w  w w . ja v  a 2s . com
 * 
 * @Title: queryOrgStructure 
 * @param id
 * @throws Exception 
 * @Date 2015-10-20
 */
public JSONObject queryOrgStructure(String userId) throws Exception {
    Objects.requireNonNull(userId);

    return assemblyJson(userId, null);
}

From source file:net.maritimecloud.identityregistry.model.database.Organization.java

/** Copies this organization into the other */
public Organization copyTo(Organization org) {
    Objects.requireNonNull(org);
    org.setName(name);//from  w  w  w  . j a  v  a  2s.c om
    org.setShortName(shortName);
    org.setEmail(email);
    org.setUrl(url);
    org.setAddress(address);
    org.setCountry(country);
    org.setLogo(logo);
    org.setType(type);
    org.setApproved(approved);
    this.certificates.clear();
    this.certificates.addAll(certificates);
    this.identityProviderAttributes.clear();
    this.identityProviderAttributes.addAll(identityProviderAttributes);
    org.setChildIds();
    return org;
}

From source file:org.telegram.telegrambots.api.methods.send.SendGame.java

public SendGame setChatId(Long chatId) {
    Objects.requireNonNull(chatId);
    this.chatId = chatId.toString();
    return this;
}

From source file:org.eclipse.hono.service.AbstractApplication.java

/**
 * Adds the factories to use for creating service instances to
 * deploy the Vert.x container during startup.
 * <p>//from w  ww  . j  av a 2s.  co  m
 * 
 * @param factories The service factories.
 * @throws NullPointerException if factories is {@code null}.
 */
@Autowired
public final void addServiceFactories(final Set<ObjectFactory<? extends AbstractServiceBase<?>>> factories) {
    Objects.requireNonNull(factories);
    serviceFactories.addAll(factories);
    log.debug("added {} service factories", factories.size());
}

From source file:io.github.retz.db.Database.java

public void validate() throws Exception {
    Objects.requireNonNull(databaseURL);
    Objects.requireNonNull(dataSource);
    try (Connection conn = dataSource.getConnection();
            Statement s = conn.createStatement();
            ResultSet r = s.executeQuery("select 1")) {
    }/*from  ww  w .ja  v  a  2 s . c  o m*/
}

From source file:org.eclipse.hono.messaging.MessageForwardingEndpoint.java

/**
 * Sets the object to use for validatingJWT tokens asserting a device's registration
 * status.//from  ww  w. ja  v a  2s  . c o  m
 * 
 * @param validator The validator.
 * @throws NullPointerException if validator is {@code null}.
 */
@Autowired
@Qualifier("validation")
public void setRegistrationAssertionValidator(final RegistrationAssertionHelper validator) {
    registrationAssertionValidator = Objects.requireNonNull(validator);
}

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

/**
 * Sets the tenant service implementation this server is based on.
 *
 * @param tenantService The tenantService to set.
 * @throws NullPointerException if service is {@code null}.
 *//*from   w w  w  . jav a2 s.  c om*/
@Autowired
public final void setTenantService(final TenantService tenantService) {
    this.tenantService = Objects.requireNonNull(tenantService);
}