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:de.itsvs.cwtrpc.controller.PreparedCacheControlUriConfig.java

public PreparedCacheControlUriConfig(Pattern value, RequestMethod method, String cacheControl, Integer expires,
        boolean pragmaNoCache) {
    Assert.notNull(value, "'value' must not be null");
    if (cacheControl != null) {
        Assert.hasText(cacheControl, "'cacheControl' must not be an empty string");
    }//from   w w w. j av a2 s . c  om

    this.value = value;
    this.method = method;
    this.cacheControl = cacheControl;
    this.expires = expires;
    this.pragmaNoCache = pragmaNoCache;
}

From source file:fr.mby.portal.coreimpl.session.BasicSession.java

@Override
public Object getAttribute(final String name) throws IllegalArgumentException {
    Assert.hasText(name, "No property name provided !");

    return this.session.get(name);
}

From source file:fr.mby.portal.coreimpl.acl.BasicRoleFactory.java

@Override
public IRole build(final String name) throws RoleNotFoundException {
    Assert.hasText(name, "No name provided !");

    final IRole newRole = this.rolesCache.get(name);

    if (newRole == null) {
        throw new RoleNotFoundException(name);
    }/*from  w  w w .  jav  a 2s. com*/

    return newRole;
}

From source file:cn.designthoughts.sample.axon.sfav.customer.domain.Address.java

/**
 * Creates a new {@link Address} from the given street, city and country.
 * //from www.  j a va  2 s . c om
 * @param building must not be {@literal null} or empty.
 * @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 building, String street, String city, String country) {

    Assert.hasText(building, "Building must not be null or empty!");
    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.building = building;
    this.street = street;
    this.city = city;
    this.country = country;
}

From source file:org.esco.portlet.changeetab.service.impl.BasicUserService.java

@Override
public void changeCurrentEtablissement(final String userId, final Etablissement etab) {
    Assert.hasText(userId, "No user Id supplied !");
    Assert.notNull(etab, "No etablishement supplied !");

    this.userDao.saveCurrentEtablissement(userId, etab.getId());
}

From source file:org.italiangrid.storm.webdav.authz.util.CustomMethodAntPathRequestMatcher.java

public CustomMethodAntPathRequestMatcher(String method, String pattern, boolean caseSensitive) {

    Assert.hasText(method, "Please provide a non-empty method");
    Assert.hasText(pattern, "Please provide a non-empty pattern.");

    this.httpOrDAVMethod = method;
    this.antMatcher = new AntPathRequestMatcher(pattern, null, caseSensitive);
}

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

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

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

public void setServiceName(String serviceName) {
    Assert.hasText(serviceName, "'serviceName' must not be empty");
    this.serviceName = serviceName;
}

From source file:example.app.model.Address.java

public static Address newAddress(String street, String city, State state, String zipCode) {
    Assert.hasText(street, "street is required");
    Assert.hasText(city, "city is required");
    Assert.notNull(state, "state is required");
    Assert.hasText(zipCode, "zipCode is required");

    Address address = new Address();

    address.setStreet(street);/*from  w  w  w.  j  av  a 2s.  com*/
    address.setCity(city);
    address.setState(state);
    address.setZipCode(zipCode);

    return address;
}

From source file:fr.mby.utils.common.jpa.AbstractOsgiJpaDao.java

@Override
public void afterPropertiesSet() throws Exception {
    Assert.hasText(this.getPersistenceUnitName(), "Persistence Unit name not configured !");
    Assert.notNull(this.bundleContext, "BundleContext was not injected !");

    this.emf = OsgiJpaHelper.retrieveEmfByName(this.bundleContext, this.getPersistenceUnitName());

    Assert.notNull(this.emf, "Cannot retrieve the EntityManageFactory !");
}