Example usage for org.springframework.util Assert hasText

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

Introduction

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

Prototype

public static void hasText(@Nullable String text, Supplier<String> messageSupplier) 

Source Link

Document

Assert that the given String contains valid text content; that is, it must not be null and must contain at least one non-whitespace character.

Usage

From source file:example.complete.Customer.java

Customer(String firstname, String lastname, LocalDate birthday) {

    Assert.hasText(firstname, "Firstname must not be null or empty!");
    Assert.hasText(lastname, "Lastname must not be null or empty!");
    Assert.isTrue(birthday.isBefore(LocalDate.now()), "Date of birth must be in the past!");

    this.firstname = firstname;
    this.lastname = lastname;
    this.birthday = birthday;
}

From source file:org.juiser.spring.jwt.ClaimsExpressionEvaluator.java

public ClaimsExpressionEvaluator(String spelExpression) {
    Assert.hasText(spelExpression, "spelExpression argument cannot be null or empty.");
    ExpressionParser parser = new SpelExpressionParser();
    this.expressionString = spelExpression;
    this.expression = parser.parseExpression(spelExpression);
}

From source file:de.itsvs.cwtrpc.controller.PreparedRemoteServiceConfig.java

public PreparedRemoteServiceConfig(String serviceName, Class<?> serviceInterface,
        boolean responseCompressionEnabled, RpcTokenValidator rpcTokenValidator) {
    Assert.hasText(serviceName, "'serviceName' must not be empty");
    Assert.notNull(serviceInterface, "'serviceInterface' must not be null");

    if (!serviceInterface.isInterface()) {
        throw new IllegalArgumentException("'serviceInterface' must be an interface");
    }//from   w  ww  . ja  v  a2  s. c o  m

    this.serviceName = serviceName;
    this.serviceInterface = serviceInterface;
    this.responseCompressionEnabled = responseCompressionEnabled;
    this.rpcTokenValidator = rpcTokenValidator;
}

From source file:example.springdata.mongodb.customer.Customer.java

/**
 * Creates a new {@link Customer} with the given firstname and lastname.
 * //from   w  w w  .  j av  a2 s . co  m
 * @param firstname must not be {@literal null} or empty.
 * @param lastname must not be {@literal null} or empty.
 */
public Customer(String firstname, String lastname) {

    Assert.hasText(firstname, "Firstname must not be null or empty!");
    Assert.hasText(lastname, "Lastname must not be null or empty!");

    this.firstname = firstname;
    this.lastname = lastname;
}

From source file:cn.bjfu.springdao.jpa.domain.Address.java

/**
 * Creates a new {@link Address} from the given street, city and country.
 * /*from   w  w  w. ja  va  2s  .  c  o  m*/
 * @param street must not be {@literal null} or empty.
 * @param city must not be {@literal null} or empty.
 * @param country must not be {@literal null} or empty.
 */
public Address(String street, String city, String country) {

    Assert.hasText(street, "Street must not be null or empty!");
    Assert.hasText(city, "City must not be null or empty!");
    Assert.hasText(country, "Country must not be null or empty!");

    this.street = street;
    this.city = city;
    this.country = country;
}

From source file:com.mycompany.projetsportmanager.filter.XHttpMethodOverrideFilter.java

/**
 * Set the header name to look for HTTP methods.
 * @see #DEFAULT_HEADER_NAME//from w  ww . j  av a  2s  . co  m
 */
public void setMethodParam(String headerParam) {
    Assert.hasText(headerParam, "'headerParam' must not be empty");
    this.headerParam = headerParam;
}

From source file:de.olivergierke.whoops.customer.CustomerNumberGenerator.java

/**
 * Configures the alphabet that is used to create random new passwords. Defaults to {@value #DEFAULT_ALPHABET}.
 * //from  w w w  .  j av a2 s  . c o m
 * @param alphabet the alphabet to set
 */
public void setAlphabet(String passwordAlphabet) {
    Assert.hasText(passwordAlphabet, "Password alphabet must not be empty!");
    this.alphabet = passwordAlphabet;
}

From source file:fr.acxio.tools.agia.alfresco.configuration.RefAssociationDefinitionFactoryBean.java

@Override
public void afterPropertiesSet() {
    super.afterPropertiesSet();
    Assert.hasText(reference, "'reference' must not be empty.");
}

From source file:org.italiangrid.storm.webdav.authz.vomap.DefaultVOMembershipProvider.java

public DefaultVOMembershipProvider(String voName, VOMembershipSource membershipSource) {

    Assert.hasText(voName, "voName cannot be null or empty!");
    Assert.notNull(membershipSource, "membershipSource cannot be null!");

    this.voName = voName;
    this.membershipSource = membershipSource;
    members = this.membershipSource.getVOMembers();
}

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);
}