Example usage for org.springframework.util Assert notNull

List of usage examples for org.springframework.util Assert notNull

Introduction

In this page you can find the example usage for org.springframework.util Assert notNull.

Prototype

public static void notNull(@Nullable Object object, Supplier<String> messageSupplier) 

Source Link

Document

Assert that an object is not null .

Usage

From source file:io.jmnarloch.spring.boot.rxjava.subscribable.Subscribables.java

public static Subscribable toSubscribable(Object result) {
    Assert.notNull(result, "Parameter 'result' can not be null");
    if (result instanceof Observable) {
        return new ObservableSubscribable((Observable) result);
    } else if (result instanceof Single) {
        return new SingleSubscribable((Single) result);
    } else {/*from   w  w  w . jav  a  2 s.c o m*/
        throw new IllegalStateException(
                String.format("The %s type can not be converted to Subscribable", result.getClass().getName()));
    }
}

From source file:fr.mby.opa.osgi.service.OsgiPortalServiceLocator.java

public static WebApplicationContext retrieveWebApplicationContext() {
    final WebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext();

    Assert.notNull(wac, "WebApplicationContext not initialized yet !");

    return wac;//  ww  w  .  j a va 2  s  .c  o  m
}

From source file:org.carewebframework.smart.SmartUtil.java

/**
 * Returns the SMART context implementation corresponding to the specified scope.
 * // w  ww . java  2 s.  c  o  m
 * @param contextScope The name of the SMART context scope.
 * @return The context implementation.
 */
public static ISmartContext getContext(String contextScope) {
    ISmartContext context = SpringUtil.getBean(SMART_CONTEXT_PREFIX + contextScope, ISmartContext.class);
    Assert.notNull(context, "Unknown SMART context type: " + contextScope);
    return context;
}

From source file:com.frank.search.solr.core.query.QueryFunction.java

/**
 * @param query/*from ww w  . j av  a 2  s.c o  m*/
 * @return
 */
public static QueryFunction query(Query query) {
    Assert.notNull(query, "Cannot create query function for 'null' query.");

    return new QueryFunction(query);
}

From source file:com.frank.search.solr.core.SolrTransactionSynchronizationAdapterBuilder.java

/**
 * @param solrOperations must not be {@literal null}
 * @return//from w ww.  ja v  a  2  s.  c om
 */
public static SolrTransactionSynchronizationAdapterBuilder forOperations(SolrOperations solrOperations) {

    Assert.notNull(solrOperations, "SolrOperations for transaction syncronisation must not be 'null'");
    SolrTransactionSynchronizationAdapterBuilder builder = new SolrTransactionSynchronizationAdapterBuilder();
    builder.adapter = new SolrTransactionSynchronizationAdapter(solrOperations);
    return builder;
}

From source file:de.itsvs.cwtrpc.controller.RemoteServiceContextHolder.java

static void setContext(RemoteServiceContext serviceContext) {
    Assert.notNull(serviceContext, "'serviceContext' must not be null");
    contextThreadLocal.set(serviceContext);
}

From source file:ch.silviowangler.dox.HashGenerator.java

public static String sha256Hex(File file) throws IOException {

    Assert.notNull(file, "file must not be null");

    logger.debug("About to generate SHA-256 hash for file '{}'. Does it exist? {}", file.getAbsolutePath(),
            file.exists());//from w  ww .ja v a2 s  . c  o  m

    InputStream inputStream = new FileInputStream(file);
    return DigestUtils.sha256Hex(inputStream);
}

From source file:lab.mage.spring.cassandra.connector.util.TenantContextHolder.java

public static void setIdentifier(@Nonnull final String identifier) {
    Assert.notNull(identifier, "A tenant identifier must be given!");
    TenantContextHolder.THREAD_LOCAL.set(identifier);
}

From source file:com.frank.search.solr.core.query.NotFunction.java

/**
 * @param field must not be null//  ww w.j a  v  a 2  s  .  co  m
 * @return
 */
public static NotFunction not(Field field) {
    Assert.notNull(field, "Field for not function must not be 'null'");

    return not(field.getName());
}

From source file:com.frank.search.solr.core.query.GeoHashFunction.java

/**
 * @param location must not be null//from   w  w  w .j  av  a2s  .c o  m
 * @return
 */
public static GeoHashFunction geohash(Point location) {
    Assert.notNull(location, "Location for geohash function must not be 'null'");

    return new GeoHashFunction(location);
}