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:com.icfcc.cache.annotation.AnnotationCacheOperationSource.java

/**
 * Create a custom AnnotationCacheOperationSource.
 * @param annotationParsers the CacheAnnotationParser to use
 *///  w  w  w.  j  a va  2  s .c om
public AnnotationCacheOperationSource(CacheAnnotationParser... annotationParsers) {
    this.publicMethodsOnly = true;
    Assert.notEmpty(annotationParsers, "At least one CacheAnnotationParser needs to be specified");
    Set<CacheAnnotationParser> parsers = new LinkedHashSet<CacheAnnotationParser>(annotationParsers.length);
    Collections.addAll(parsers, annotationParsers);
    this.annotationParsers = parsers;
}

From source file:ee.kovmen.xtee.consumer.CustomWebServiceAccessor.java

/**
 * Sets the message senders used for sending messages.
 * <p/>//from  w w  w  . j  a v a  2 s  .  c  o m
 * These message senders will be used to resolve an URI to a {@link WebServiceConnection}.
 *
 * @see #createConnection(URI)
 */
public void setMessageSenders(WebServiceMessageSender[] messageSenders) {
    Assert.notEmpty(messageSenders, "'messageSenders' must not be empty");
    this.messageSenders = messageSenders;
}

From source file:fr.mby.saml2.sp.impl.om.SamlOutgoingMessage.java

/**
 * Build the SAML HTTP-POST request parameters.
 * /*from   w ww  . j a  va2s  . c om*/
 * @return the HTTP-POST request params
 */
public Collection<Entry<String, String>> buildHttpPostBindingParams() {
    final Collection<Entry<String, String>> params = this.samlDataAdaptor.buildHttpPostBindingParams(this);
    Assert.notEmpty(params, "HTTP POST params weren't built !");

    return params;
}

From source file:org.obiba.onyx.core.identifier.impl.randomincrement.RandomIncrementIdentifierSequence.java

private IdentifierSequenceState loadSequenceState() {
    List<IdentifierSequenceState> result = persistenceManager.list(IdentifierSequenceState.class);
    Assert.notEmpty(result, "IdentifierSequenceState does not exist (was the startSequence method called?)");
    Assert.isTrue(result.size() == 1,//from ww  w. j av  a  2 s.  c  om
            "Unexpected number of IdentifierSequenceState entities: " + result.size() + " (expected 1)");

    return result.get(0);
}

From source file:com.freebox.engeneering.application.web.common.ApplicationContextListener.java

/**
 * Initializes the application context by web flow xml configs.
 * @param servletContextEvent the servlet context event.
 *///w  w w.  j  a v  a  2s.com
public void contextInitialized(ServletContextEvent servletContextEvent) {
    final ServletContext servletContext = servletContextEvent.getServletContext();
    final WebApplicationContext context = WebApplicationContextUtils
            .getRequiredWebApplicationContext(servletContext);

    String initParameter = servletContext.getInitParameter(CONFIG_LOCATION_PARAM);
    final String[] configLocations = getConfigLocations(context, initParameter);

    final Set<URL> xmlConfigs = new HashSet<URL>();
    for (String configLocation : configLocations) {
        try {
            final Resource[] locationResources = context.getResources(configLocation);
            for (Resource locationResource : locationResources) {
                xmlConfigs.add(locationResource.getURL());
            }
        } catch (IOException e) {
            if (LOGGER.isErrorEnabled()) {
                LOGGER.error("Could not find state chart configuration", e);
            }
        }
    }
    Assert.notEmpty(xmlConfigs, "Cannot find state chart configuration.");

    ApplicationContextLocator.setWebFlowConfiguration(xmlConfigs);
    ApplicationContextLocator.setApplicationContext(context);

    final FlowConfigurationLoader flowConfigurationLoader = (FlowConfigurationLoader) context
            .getBean("flowConfigurationLoader");
    flowConfigurationLoader.init(xmlConfigs);
}

From source file:com.developmentsprint.spring.breaker.annotations.AnnotationCircuitBreakerAttributeSource.java

/**
 * Create a custom AnnotationTransactionAttributeSource.
 * /*from w  ww. j a  va2  s .  co m*/
 * @param annotationParsers
 *            the TransactionAnnotationParsers to use
 */
public AnnotationCircuitBreakerAttributeSource(CircuitBreakerAnnotationParser... annotationParsers) {
    this.publicMethodsOnly = true;
    Assert.notEmpty(annotationParsers, "At least one CircuitBreakerAnnotationParser needs to be specified");
    Set<CircuitBreakerAnnotationParser> parsers = new LinkedHashSet<CircuitBreakerAnnotationParser>(
            annotationParsers.length);
    Collections.addAll(parsers, annotationParsers);
    this.annotationParsers = parsers;
}

From source file:com.careerly.common.support.ReloadablePropertySourcesPlaceholderConfigurer.java

@Override
public void afterPropertiesSet() throws Exception {
    Assert.notEmpty(locations, "properties reload, locations not given");
    // ??/*from   w  w  w  . ja  va 2s.co  m*/
    for (Resource resource : locations) {
        long modified = resource.lastModified();
        String modifiedTime = new DateTime(modified).toString("yyyy-MM-dd HH:mm:ss");
        logger.info("properties monitor, file: {}, modified: {}", resource.getFile().getPath(), modifiedTime);
        lastModifiedResources.put(resource, modified);
    }
    // ??Constant?
    for (String beanName : beanFactory.getBeanDefinitionNames()) {
        if (beanName.endsWith("Constant")) {
            logger.info("properties monitor, bean: {}", beanName);
            beanNames.add(beanName);
        }
    }
    // ??10??JDK7?nio2 Watch Service
    scheduler = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("properties-reload"));
    scheduler.scheduleWithFixedDelay(this, 120L, 10L, TimeUnit.SECONDS);
}

From source file:ee.kovmen.xtee.consumer.CustomWebServiceAccessor.java

public void afterPropertiesSet() {
    Assert.notNull(getMessageFactory(), "Property 'messageFactory' is required");
    Assert.notEmpty(getMessageSenders(), "Property 'messageSenders' is required");
}

From source file:cz.jirutka.spring.data.jdbc.TableDescription.java

/**
 * @param pkColumns A list of columns names that are part of the table's
 *        primary key.//from  ww w.java 2 s.  co  m
 * @throws IllegalArgumentException if {@code pkColumn} is empty.
 */
public void setPkColumns(List<String> pkColumns) {
    Assert.notEmpty(pkColumns, "At least one primary key column must be provided");
    this.pkColumns = unmodifiableList(pkColumns);
}

From source file:com.flipkart.aesop.runtime.client.DefaultClientFactory.java

/**
 * Interface method implementation. Checks for mandatory dependencies and initializes this Relay Client
 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
 *//*from  w  ww.  j  a  v a  2  s .  c om*/
public void afterPropertiesSet() throws Exception {
    Assert.notNull(this.clientConfig,
            "'clientConfig' cannot be null. This Relay Client will not be initialized");
    Assert.notEmpty(this.consumerRegistrationList,
            "'consumerRegistrationList' cannot be empty. No Event consumers registered");
}