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.jnap.core.mvc.i18n.CompositeLocaleResolver.java

@Override
public void afterPropertiesSet() throws Exception {
    Assert.notEmpty(resolvers, "You must set at least one LocaleResolver strategy.");
}

From source file:com.frank.search.solr.SolrRealtimeGetRequest.java

public SolrRealtimeGetRequest(Collection<? extends Serializable> ids) {
    super(METHOD.GET, "/get");

    Assert.notEmpty(ids, "At least one 'id' is required for real time get request.");
    Assert.noNullElements(ids.toArray(), "Real time get request can't be made for 'null' id.");

    toStringIds(ids);/*  ww  w.  ja  va 2 s  .c  o  m*/
}

From source file:gov.nyc.doitt.gis.geoclient.parser.regex.Match.java

public Match(ParseContext parseContext, MatchType matchType, Matcher matcher,
        List<RegexTokenGroup> matchGroups) {
    super();/*from w ww .java  2s  . c o m*/
    Assert.notNull(parseContext, "ParseContext argument cannot be null.");
    this.parseContext = parseContext;
    Assert.notNull(matchType, "MatchType argument cannot be null.");
    this.matchType = matchType;
    Assert.notNull(matcher, "MatchResult argument cannot be null.");
    this.matcher = matcher;
    Assert.notEmpty(matchGroups, "List<RegexTokenGroup> argument cannot be empty or null.");
    this.matchGroups = matchGroups;
}

From source file:com.autentia.wuija.i18n.SequenceResource.java

public SequenceResource(Resource[] resources) {
    Assert.notEmpty(resources, "Array of resources cannot be null or empty");
    this.resources = resources;
}

From source file:org.springmodules.validation.util.condition.bean.EqualPropertiesBeanCondition.java

/**
 * Constructs a new EqualPropertiesBeanCondition with a given list of names of the properties to be compared.
 *
 * @param propertyNames The name of the properties to be compared.
 * @throws IllegalArgumentException when the given property names array contains zero or one names.
 */// w w  w  . j  a  v a  2  s .  co  m
public EqualPropertiesBeanCondition(String[] propertyNames) {
    Assert.notNull(propertyNames,
            getClass().getName() + " cannot be initialized with null array of property names");
    Assert.notEmpty(propertyNames,
            getClass().getName() + " cannot be initialized with less then 2 property names");
    for (int i = 0; i < propertyNames.length; i++) {
        Assert.notNull(propertyNames[i],
                getClass().getName() + " cannot be initialized with null property name");
    }
    this.propertyNames = propertyNames;
}

From source file:annis.sqlgen.AbstractUnionSqlGenerator.java

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

    StringBuffer sb = new StringBuffer();

    sb.append(indent);//  ww w .j ava  2s  . c o m
    List<String> alternatives = new ArrayList<String>();
    for (List<QueryNode> alternative : queryData.getAlternatives()) {
        alternatives.add(createSqlForAlternative(queryData, alternative, indent));
    }
    sb.append(StringUtils.join(alternatives, "\n" + indent + "UNION "));

    // ORDER BY and LIMIT/OFFSET clauses cannot depend on alternative?
    appendOrderByClause(sb, queryData, null, indent);
    appendLimitOffsetClause(sb, queryData, null, indent);

    return sb.toString();
}

From source file:com.azaptree.services.command.impl.CommandCatalogImpl.java

public CommandCatalogImpl(final String name, final Command... commands) {
    Assert.hasText(name, "name is required");
    Assert.notEmpty(commands, "commands are required");
    checkCommandNamesAreUnique(commands);

    this.name = name;

    final ImmutableMap.Builder<String, org.apache.commons.chain.Command> mapBuilder = ImmutableMap.<String, org.apache.commons.chain.Command>builder();
    for (final Command command : commands) {
        Assert.hasText(command.getName(), "command.name is required");
        mapBuilder.put(command.getName(), command);
    }/*w  w w .j a v  a 2  s.c o m*/
    this.commands = mapBuilder.build();
}

From source file:gemfire.practice.service.DefautOrderService.java

/**
 * Create an order//from   w ww.j  a v a 2 s .  c  o  m
 * 
 * @param order
 * @return
 */
@Override
public Order create(Order order) {
    Assert.notNull(order, "order cannot be null");
    Assert.notNull(order.getId(), "order ID cannot be null");
    Assert.notNull(order.getCustomerId(), "order customer ID cannot be null");
    Assert.notEmpty(order.getLineItems(), "order must contain at least one line item");
    Assert.notNull(order.getBillingAddress(), "order billing address cannot be null");

    log.debug("creating new order " + order.getId());
    return orderRepository.save(order);
}

From source file:org.hdiv.config.annotation.ExclusionRegistry.java

public UrlExclusionRegistration addUrlExclusions(String... urlPatterns) {
    Assert.notEmpty(urlPatterns, "Url patterns are required");
    UrlExclusionRegistration registration = new UrlExclusionRegistration(urlPatterns);
    urlRegistrations.add(registration);//from   www  .  j a  va 2s  .com
    return registration;
}

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

/**
 * Constructs a new ImmutableAssertion out of the given parameters.
 * //from  w w  w.j av a 2 s  .  com
 * @param principals the chain of principals
 * @param service The service we are asserting this ticket for.
 * @param fromNewLogin was the service ticket from a new login.
 * @throws IllegalArgumentException if there are no principals.
 */
public ImmutableAssertionImpl(final List<Authentication> principals, final Service service,
        final boolean fromNewLogin) {
    Assert.notNull(principals, "principals cannot be null");
    Assert.notNull(service, "service cannot be null");
    Assert.notEmpty(principals, "principals cannot be empty");

    this.principals = principals;
    this.service = service;
    this.fromNewLogin = fromNewLogin;
}