Example usage for org.springframework.util Assert notEmpty

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

Introduction

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

Prototype

public static void notEmpty(@Nullable Map<?, ?> map, Supplier<String> messageSupplier) 

Source Link

Document

Assert that a Map contains entries; that is, it must not be null and must contain at least one entry.

Usage

From source file:org.cleverbus.api.route.XPathValidator.java

/**
 * Creates new XPath validator./*w  w w .  jav a2s.  co  m*/
 *
 * @param parentElm the parent element (if any)
 * @param ns the namespace(s)
 * @param elements the element names;
 */
public XPathValidator(@Nullable String parentElm, Namespaces ns, String... elements) {
    Assert.notNull(ns, "the ns must not be null");
    Assert.notEmpty(elements, "the elements must not be empty");

    this.ns = ns;
    this.parentElm = parentElm;
    this.elements = elements;
}

From source file:ch.rasc.wampspring.config.WebMvcWampWebSocketEndpointRegistration.java

public WebMvcWampWebSocketEndpointRegistration(String[] paths, WebSocketHandler webSocketHandler,
        TaskScheduler sockJsTaskScheduler) {

    Assert.notEmpty(paths, "No paths specified");
    Assert.notNull(webSocketHandler, "WebSocketHandler must not be null");

    this.paths = paths;
    this.webSocketHandler = webSocketHandler;
    this.sockJsTaskScheduler = sockJsTaskScheduler;
}

From source file:fr.mby.saml2.sp.impl.config.WayfConfig.java

@Override
public void afterPropertiesSet() throws Exception {
    Assert.notEmpty(this.idpConfigs, "No IdP Config supplied !");
    Assert.notNull(this.idpIdParamKey, "No IdP id parameter key configured !");

    // Register this config in the Helper
    SamlHelper.registerWayfConfig(this);
}

From source file:com.google.code.ssm.spring.SSMCacheManager.java

@Override
public void afterPropertiesSet() {
    Assert.notEmpty(caches, "A collection of caches is required and cannot be empty");
    this.cacheMap.clear();

    // preserve the initial order of the cache names
    for (SSMCache cache : caches) {
        addCache(cache.getName(), cache);

        // use aliases if enabled
        if (cache.isRegisterAliases() && !CollectionUtils.isEmpty(cache.getCache().getAliases())) {
            for (String alias : cache.getCache().getAliases()) {
                addCache(alias, cache);//  w w w.j a v  a  2 s.c o m
            }
        }
    }
}

From source file:annis.sqlgen.AbstractSqlGenerator.java

@Override
public String toSql(QueryData queryData, String indent) {
    Assert.notEmpty(queryData.getAlternatives(), "BUG: no alternatives");

    // push alternative down
    List<QueryNode> alternative = queryData.getAlternatives().get(0);

    StringBuffer sb = new StringBuffer();
    sb.append(indent);//  ww w  .  ja v a  2 s.c om
    sb.append(createSqlForAlternative(queryData, alternative, indent));
    appendOrderByClause(sb, queryData, alternative, indent);
    appendLimitOffsetClause(sb, queryData, alternative, indent);
    return sb.toString();
}

From source file:grails.plugin.searchable.internal.compass.search.DefaultSearchMethod.java

public Object invoke(Object[] args) {
    Assert.notNull(args, "args cannot be null");
    Assert.notEmpty(args, "args cannot be empty");

    SearchableMethod suggestQueryMethod = getMethodFactory().getMethod("suggestQuery");

    SearchCompassCallback searchCallback = new SearchCompassCallback(getCompass(), getDefaultOptions(), args);
    searchCallback.setGrailsApplication(grailsApplication);
    searchCallback.setCompassQueryBuilder(compassQueryBuilder);
    searchCallback.setHitCollector(hitCollector);
    searchCallback.setSearchResultFactory(searchResultFactory);
    searchCallback.setSuggestQueryMethod(suggestQueryMethod);
    return doInCompass(searchCallback);
}

From source file:com.creactiviti.piper.core.pipeline.YamlPipelineRepository.java

private Map<String, Object> parse(Resource aResource) {
    try (InputStream in = aResource.getInputStream()) {
        String yaml = IOUtils.toString(in);
        Map<String, Object> yamlMap = mapper.readValue(yaml, Map.class);
        validate(yamlMap);//from  w  w  w. j a va2  s.c o m
        List<Map<String, Object>> rawTasks = (List<Map<String, Object>>) yamlMap.get(DSL.TASKS);
        Assert.notNull(rawTasks, "no tasks found");
        Assert.notEmpty(rawTasks, "no tasks found");
        List<Task> tasks = new ArrayList<>();
        for (int i = 0; i < rawTasks.size(); i++) {
            Map<String, Object> rt = rawTasks.get(i);
            SimplePipelineTask mutableTask = new SimplePipelineTask(rt);
            mutableTask.setTaskNumber(i + 1);
            tasks.add(mutableTask);
        }
        yamlMap.put(DSL.TASKS, tasks);
        return yamlMap;
    } catch (IOException e) {
        throw Throwables.propagate(e);
    }
}

From source file:org.trpr.platform.batch.impl.spring.processor.CompositeItemProcessor.java

/**
 * Interface method implementation. Ensures that the ItemProcessor delegates have been set and is not empty
 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
 *///  w  w  w.j  a  va 2  s  .  co  m
public void afterPropertiesSet() throws Exception {
    Assert.notNull(delegates, "The 'delegates' may not be null");
    Assert.notEmpty(delegates, "The 'delegates' may not be empty");
}

From source file:io.gravitee.gateway.handlers.api.http.client.spring.HttpClientConfigurationImportSelector.java

/**
 * Return the HTTP client class names that should be considered. By default
 * this method will load candidates using {@link SpringFactoriesLoader} with
 * {@link #getSpringFactoriesLoaderFactoryClass()}.
 * attributes}// w w  w .j av  a  2  s .c  om
 * @return a list of candidate configurations
 */
protected List<String> getCandidateConfigurations() {
    List<String> configurations = SpringFactoriesLoader.loadFactoryNames(getSpringFactoriesLoaderFactoryClass(),
            this.getClass().getClassLoader());
    Assert.notEmpty(configurations, "No HTTP client classes found in META-INF/spring.factories. If you"
            + "are using a custom packaging, make sure that file is correct.");
    return configurations;
}

From source file:org.jasig.cas.validation.ImmutableAssertion.java

/**
 * Creates a new instance with required parameters.
 *
 * @param primary Primary authentication.
 * @param chained Chained authentitications.
 * @param service The service we are asserting this ticket for.
 * @param fromNewLogin True if the ticket was issued as a result of authentication, false otherwise.
 *
 * @throws IllegalArgumentException If any of the given arguments do not meet requirements.
 *///  w ww. jav a2  s  .c o  m
public ImmutableAssertion(final Authentication primary, final List<Authentication> chained,
        final Service service, final boolean fromNewLogin) {

    Assert.notNull(primary, "primary authentication cannot be null");
    Assert.notNull(chained, "chained authentications cannot be null");
    Assert.notNull(service, "service cannot be null");
    Assert.notEmpty(chained, "chained authentications cannot be empty");

    this.primaryAuthentication = primary;
    this.chainedAuthentications = chained;
    this.service = service;
    this.fromNewLogin = fromNewLogin;
}