Example usage for org.springframework.util Assert isTrue

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

Introduction

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

Prototype

public static void isTrue(boolean expression, Supplier<String> messageSupplier) 

Source Link

Document

Assert a boolean expression, throwing an IllegalArgumentException if the expression evaluates to false .

Usage

From source file:org.cleverbus.api.event.ProcessingMsgAsynchEvent.java

/**
 * Creates new event./*from  w  w  w.ja va 2  s.com*/
 *
 * @param exchange the exchange
 * @param message  the message
 */
public ProcessingMsgAsynchEvent(Exchange exchange, Message message) {
    super(exchange, message);

    Assert.isTrue(message.getState() == MsgStateEnum.PROCESSING,
            "the message must be in the state " + MsgStateEnum.PROCESSING);
}

From source file:org.grails.datastore.gorm.mongo.WithinCircle.java

@Override
public void setArguments(Object[] arguments) {
    Assert.isTrue(arguments.length > 0 && arguments[0] instanceof List,
            "Only a list of elements is supported in a 'WithinCircle' query");

    Collection<?> argument = (Collection<?>) arguments[0];
    Assert.isTrue(argument.size() == 2, "A 'WithinCircle' query requires a two dimensional list of values");

    super.setArguments(arguments);
}

From source file:org.synyx.hades.dao.query.ParameterBinder.java

/**
 * Creates a new {@link ParameterBinder}.
 * /*from w w  w  . ja  va  2  s  .  c  o m*/
 * @param parameters
 * @param values
 */
public ParameterBinder(Parameters parameters, Object... values) {

    Assert.notNull(parameters);
    Assert.notNull(values);

    Assert.isTrue(parameters.getNumberOfParameters() == values.length, "Invalid number of parameters given!");

    this.parameters = parameters;
    this.values = values;
}

From source file:com.gopivotal.cla.EnvironmentVariableConfiguration.java

@Bean
String encryptionKey() {//from w  w w .j  a v  a  2s. c  om
    String encryptionKey = getRequiredProperty("ENCRYPTION_KEY");
    Assert.isTrue(encryptionKey.length() >= MINIMUM_ENCRYPTION_KEY_LENGTH, String.format(
            "The minimum length for the ENCRYPTION_KEY is %d characters", MINIMUM_ENCRYPTION_KEY_LENGTH));

    return encryptionKey;
}

From source file:com.jaxio.celerio.factory.InheritanceFactory.java

public void wireEntityHierarchies() {
    // wire the entities parent/child
    for (Entity entity : config.getProject().getCurrentEntities()) {
        if (entity.hasParentEntityName()) {
            Entity parentEntity = config.getProject().getEntityByName(entity.getParentEntityName());
            Assert.isTrue(!parentEntity.equals(entity),
                    "The entity " + entity.getName() + " inherits from itself! Please fix your configuration.");
            entity.setParent(parentEntity);
        }// w w w  .  j a va 2  s . c o m
    }

    putEntityByTableNameForEntityWithInheritance();
}

From source file:grails.plugin.springsecurity.web.authentication.FilterProcessUrlRequestMatcher.java

public FilterProcessUrlRequestMatcher(String filterProcessesUrl) {
    Assert.hasLength(filterProcessesUrl, "filterProcessesUrl must be specified");
    Assert.isTrue(UrlUtils.isValidRedirectUrl(filterProcessesUrl),
            filterProcessesUrl + " isn't a valid redirect URL");
    this.filterProcessesUrl = filterProcessesUrl;
}

From source file:net.projectmonkey.spring.acl.factory.DefaultAclAuthorizationStrategyFactoryBean.java

public DefaultAclAuthorizationStrategyFactoryBean(final String... authorisations) {
    Assert.notEmpty(authorisations);//from w ww . j a va  2 s  .c  o m
    Assert.isTrue(authorisations.length == 1 || authorisations.length == 3,
            "Either 1 or 3 authorization strings must be provided");
    this.authorisations = authorisations;
}

From source file:org.pshow.ecm.utils.cache.EhcacheStore.java

public void init() {
    Assert.hasText(name, "the name of EhCacheMetisStore must have text");
    Assert.notNull(cacheManager, "this cacheManager must not be null");
    Assert.isTrue(cacheManager.cacheExists(name), "ehcache whose cacheName is " + name + " is not configured");

    this.ehcache = cacheManager.getEhcache(name);
}

From source file:com.icesoft.spring.security.JsfInvalidSessionStrategy.java

public JsfInvalidSessionStrategy(String invalidSessionUrl) {
    Assert.isTrue(UrlUtils.isValidRedirectUrl(invalidSessionUrl), "url must start with '/' or with 'http(s)'");
    this.invalidSessionUrl = invalidSessionUrl;
}

From source file:com.oreilly.springdata.gemfire.order.LineItem.java

/**
 * Creates a new {@link LineItem} for the given {@link Product} and amount.
 * @param product must not be {@literal null}.
 * @param amount/*from   ww w  . j a va2s  .co m*/
 */
public LineItem(Product product, int amount) {
    Assert.notNull(product, "The given Product must not be null!");
    Assert.isTrue(amount > 0, "The amount of Products to be bought must be greater than 0!");

    this.productId = product.getId();
    this.amount = amount;
    this.price = product.getPrice();
}