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:cz.jirutka.spring.unboundid.LdapConnectionFactoryBean.java

public void afterPropertiesSet() {
    Assert.hasText(host, "host or URL must be provided");

    if (port < 1) {
        port = ssl ? DEFAULT_SSL_PORT : DEFAULT_PORT;
    }/*from   w  w  w. jav  a 2s  . c o  m*/
}

From source file:cat.albirar.framework.sets.registry.impl.SetRegistryDefaultImpl.java

/**
 * {@inheritDoc}/*from ww w  . j a  v a2  s .  c  o  m*/
 */
@Override
public boolean removeSet(String setName) {
    Assert.hasText(setName, "The setName are required and cannot be empty or only whitespace!");
    return (registry.remove(setName) != null);
}

From source file:org.opencredo.cloud.storage.azure.AzureTemplate.java

/**
 * @param credentials          Azure credentials
 * @param defaultContainerName Default container name.
 *//*from  ww w . j  a va2s. c  o m*/
public AzureTemplate(final AzureCredentials credentials, String defaultContainerName) {
    super();
    Assert.hasText(defaultContainerName, "Default container name is not provided");
    this.defaultContainerName = defaultContainerName;

    XPathOperations xpathOperations = new Jaxp13XPathTemplate();
    restService = new DefaultAzureRestService(credentials, new XPathContainerNamesListFactory(xpathOperations),
            new XPathContainerObjectDetailsListFactory(xpathOperations));
}

From source file:org.cleverbus.core.common.directcall.DirectCallWsRoute.java

/**
 * Gets request to external system.//from  w  w w .  jav  a  2s . c om
 *
 * @param callId Call ID for getting call parameters from {@link DirectCallRegistry}
 * @return request
 */
@Handler
public Object getRequest(@Header(CALL_ID_HEADER) String callId) {
    Assert.hasText(callId, "the callId must not be empty");

    DirectCallParams params = callRegistry.getParams(callId);

    Log.debug("Direct WS call: uri= " + params.getUri() + ",\nsenderRef= " + params.getSenderRef()
            + ",\nsoapAction= " + params.getSoapAction() + ",\nbody: " + params.getBody());

    return params.getBody();
}

From source file:com.google.code.ssm.json.ClassAliasIdResolver.java

/**
 * Adds single mapping: class <-> alias (id).
 * /*ww w  . j ava 2  s  . c  o  m*/
 * @param clazz
 * @param id
 */
public void addClassToId(final Class<?> clazz, final String id) {
    Assert.notNull(clazz, "Class cannot be null");
    Assert.hasText(id, "Alias (id) cannot be null or contain only whitespaces");

    if (classToId.containsKey(clazz)) {
        throw new IllegalArgumentException("Class " + clazz + " has already defined alias (id) "
                + classToId.get(clazz) + " cannot set another alias " + id);
    }

    if (idToClass.containsKey(id)) {
        throw new IllegalArgumentException("Alias (id) " + id + " is used by another class " + idToClass.get(id)
                + " and cannot be used by " + clazz);
    }

    classToId.put(clazz, id);
    idToClass.put(id, clazz);
}

From source file:com.buession.cas.web.controller.ValidateCaptchaController.java

/**
 * ???//w  w w  .  ja  va 2  s .c om
 * 
 * @param requestParamName
 *        ???
 */
public void setRequestParamName(final String requestParamName) {
    Assert.hasText(requestParamName, "RequestParamName must be have length; it could not be null or empty");
    this.requestParamName = requestParamName;
}

From source file:us.swcraft.springframework.cache.aerospike.AerospikeCacheManager.java

public AerospikeCache createCache(final String name, int timeToLive) {
    Assert.hasText(name, "Cache name can't be empty");
    AerospikeTemplate template = null;/*  www .  ja  v a  2 s  .  c  om*/

    if (name.contains(":")) {
        // namespace explicitly defined
        String[] nameParts = name.split(":", 2);
        template = buildAerospikeTemplate(nameParts[0], nameParts[1]);
    } else {
        template = buildAerospikeTemplate(defaultNamespace, name);
    }
    template.setExpiration(timeToLive);
    final AerospikeCache cache = new AerospikeCache(template, serializer);
    caches.put(cache.getName(), cache);
    return cache;

}

From source file:curly.artifact.ArtifactServiceImpl.java

@Async
@Override//  w  w  w .  j  a va2  s  .  co m
@Loggable
@Retryable
@HystrixCommand
public void delete(String id, OctoUser user) {
    Assert.notNull(user, "OctoUser must be not null");
    Assert.hasText(id, "Id must be not empty");
    log.trace("Looking for entity with id {}", id);
    findOne(id).filter(artifact -> isOwnedBy(artifact.orElseThrow(ResourceNotFoundException::new), user))
            .doOnNext(artifact -> repository.delete(artifact.get())).doOnError(throwable -> log
                    .error("Cannot process #delete({},{}) nested exception is, {}", id, user.getId()));
}

From source file:org.openwms.core.lang.I18n.java

/**
 * Create a new I18n./*w  w w  .j  av a2 s .com*/
 *
 * @param key The key to access this translation
 * @param lang A set of languages
 * @throws IllegalArgumentException when the {@code key} is {@literal null} or empty
 */
public I18n(String key, I18nSet lang) {
    super();
    Assert.hasText(key, "Not allowed to create an I18n instance with an empty key");
    this.key = key;
    this.lang = lang;
}

From source file:org.openwms.core.configuration.file.ApplicationPreference.java

/**
 * Create a new {@code ApplicationPreference}.
 *
 * @param key the key/*  w ww.j  ava 2  s .  c  om*/
 * @throws IllegalArgumentException when key is {@literal null} or empty
 */
public ApplicationPreference(String key) {
    // Called from the client-side only.
    super();
    Assert.hasText(key, "Not allowed to create an ApplicationPreference with an empty key");
    this.key = key;
}