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:com.shengpay.commons.bp.zk.ZkTemplate.java

public void init() throws Exception {
    Assert.notNull(curator, "ZooKeeperClient can't be null.");
    Assert.notNull(lockPath, "Lock Path can't be null.");

    //?Zookeeper/*from   ww w  .j  a v  a 2  s.co m*/
    if (!this.curator.isStarted()) {
        this.curator.start();
    }

    //??
    locker = new InterProcessMutex(curator, this.lockPath);
}

From source file:org.infinispan.spring.spi.SpringCache.java

/**
 * @param nativeCache/*  w w w. j av  a  2s.c  o  m*/
 */
public SpringCache(final org.infinispan.Cache<K, V> nativeCache) {
    Assert.notNull(nativeCache, "A non-null Infinispan cache implementation is required");
    this.nativeCache = nativeCache;
}

From source file:org.arrow.runtime.scope.ProcessScope.java

/**
* {@inheritDoc}/*ww w  .j  av  a2s  .c  om*/
*/
@Override
public Object get(String key, ObjectFactory<?> beanFactory) {

    Map<String, Object> map = EngineSynchronizationManager.getProcessScope();
    Assert.notNull(map, "map is null, key: " + key);
    if (map.containsKey(key)) {
        return map.get(key);
    }
    map.put(key, beanFactory.getObject());
    return map.get(key);
}

From source file:reactor.spring.context.ReactorFactoryBean.java

public ReactorFactoryBean(Environment env, String dispatcher, EventRouting eventRouting) {
    Assert.notNull(env, "Environment cannot be null.");
    this.env = env;

    Reactor.Spec spec = R.reactor().using(env);
    if (null != dispatcher) {
        if ("sync".equals(dispatcher)) {
            spec.using(SynchronousDispatcher.INSTANCE);
        } else {/*from w w  w . jav a  2  s  . c  o  m*/
            spec.dispatcher(dispatcher);
        }
    }
    if (null != eventRouting) {
        switch (eventRouting) {
        case BROADCAST_EVENT_ROUTING:
            spec.broadcastEventRouting();
            break;
        case RANDOM_EVENT_ROUTING:
            spec.randomEventRouting();
            break;
        case ROUND_ROBIN_EVENT_ROUTING:
            spec.roundRobinEventRouting();
            break;
        }
    }
    this.reactor = spec.get();
}

From source file:at.porscheinformatik.common.spring.web.extended.expression.ScriptExpressionHandler.java

@Override
public String process(String value) {
    Assert.notNull(scriptConfig, "No scriptstack defined");
    Assert.isTrue(scriptConfig.hasStack(value), "ScriptStack " + value + " not found");

    if (config.isOptimizeResources()) {
        return HtmlUtils.buildScriptLink(generateUrl("script/stack", value));
    } else {//from   www.j  a  v  a 2  s .  c o  m
        return buildDevelopmentScripts(value);
    }
}

From source file:com.flipkart.aesop.processor.es.config.ElasticSearchConfig.java

public void afterPropertiesSet() throws Exception {
    /* Assert if filename is ot empty */
    Assert.notNull(this.config,
            "'ElasticSearchConfig' cannot be null. This Databus Client will not be initialized");
}

From source file:org.eclipse.swordfish.core.configuration.ManagedServiceAdapter.java

public void updated(Dictionary properties) throws ConfigurationException {
    Assert.notNull(delegate, "The ConfigurationConsumer delegate must be supplied");
    if (properties == null) {
        delegate.onReceiveConfiguration(null);
        return;/*ww w .  j  ava  2s.  c o m*/
    }
    Map configuration = new HashMap();
    Enumeration e = properties.keys();
    while (e.hasMoreElements()) {
        Object key = e.nextElement();
        configuration.put(key, properties.get(key));
    }
    LOG.info(String.format("Received configuration [%s] for the configurationConsumer with id = [%s] ",
            configuration.toString(), delegate.getId()));

    delegate.onReceiveConfiguration(configuration);

}

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

public SimpleGroupResult(int matches, Integer groupsCount, String name, Page<GroupEntry<T>> groupEntries) {
    Assert.isTrue(matches >= 0, "matches must be >= 0");
    Assert.hasLength(name, "group result name must be not empty");
    Assert.notNull(groupEntries, "groupEntries must be not null");
    this.matches = matches;
    this.groupsCount = groupsCount;
    this.name = name;
    this.groupEntries = groupEntries;
}

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

public final void addTermsResult(List<TermsFieldEntry> entries, String fieldname) {
    Assert.notNull(fieldname, "Cannot add terms for 'null' field.");
    this.termsMap.put(new StringPageKey(fieldname), entries);
}

From source file:grails.plugin.searchable.internal.compass.support.AbstractSearchableMethod.java

public AbstractSearchableMethod(String methodName, Compass compass, SearchableMethodFactory methodFactory,
        Map defaultOptions) {/* w  w w  .  ja va 2s .c o  m*/
    Assert.notNull(methodName, "methodName cannot be null");
    Assert.notNull(compass, "compass cannot be null");
    this.methodName = methodName;
    this.compass = compass;
    this.methodFactory = methodFactory;
    this.defaultOptions = defaultOptions;
}