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:fr.acxio.tools.agia.item.MultiLineItemReader.java

public synchronized void setCurrentVariableName(String sCurrentVariableName) {
    Assert.hasText(sCurrentVariableName, "currentVariableName must not be empty");
    currentVariableName = sCurrentVariableName;
}

From source file:org.openwms.common.location.LocationType.java

/**
 * Create a new {@code LocationType} with an unique natural key.
 *
 * @param type Unique type/*from w  ww  . jav  a 2  s.  c  o  m*/
 */
public LocationType(String type) {
    Assert.hasText(type, "type must exist when creating a new LocationType");
    this.type = type;
}

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

public static Contact newContact(Person person, String email, PhoneNumber phoneNumber) {
    Assert.notNull(person, "Person is required");
    Assert.hasText(email, "Email is required");
    Assert.notNull(phoneNumber, "PhoneNumber is required");

    Contact contact = new Contact();

    contact.setPerson(person);/*from www  .  ja v a2  s  . c  o  m*/
    contact.setEmail(email);
    contact.setPhoneNumber(phoneNumber);

    return contact;
}

From source file:sipackage.core.SIAdapterUpperPrefixExecutor.java

/**
 * Example property to illustrate usage of properties in Spring Integration
 * components. Replace with your own logic.
 *
 * @param exampleProperty Must not be null
 *//*ww w  .  ja va2  s .  com*/
public void setExampleProperty(String exampleProperty) {
    Assert.hasText(exampleProperty, "exampleProperty must be neither null nor empty");
    this.exampleProperty = exampleProperty;
}

From source file:com.google.code.ssm.CacheImpl.java

CacheImpl(final String name, final Collection<String> aliases, final CacheClient cacheClient,
        final SerializationType defaultSerializationType, final JsonTranscoder jsonTranscoder,
        final JavaTranscoder javaTranscoder, final CacheTranscoder customTranscoder,
        final CacheProperties properties) {
    Assert.hasText(name, "'name' must not be null, empty, or blank");
    Assert.notNull(aliases, "'aliases' cannot be null");
    Assert.notNull(cacheClient, "'cacheClient' cannot be null");
    Assert.notNull(defaultSerializationType, "'defaultSerializationType' cannot be null");
    Assert.notNull(properties, "'cacheProperties' cannot be null");
    validateTranscoder(SerializationType.JSON, jsonTranscoder, "jsonTranscoder");
    validateTranscoder(SerializationType.JAVA, javaTranscoder, "javaTranscoder");
    validateTranscoder(SerializationType.CUSTOM, customTranscoder, "customTranscoder");

    this.name = name;
    this.aliases = aliases;
    this.cacheClient = cacheClient;
    this.defaultSerializationType = defaultSerializationType;
    this.jsonTranscoder = jsonTranscoder;
    this.javaTranscoder = javaTranscoder;
    this.customTranscoder = customTranscoder;
    this.properties = properties;
}

From source file:io.curly.artifact.service.DefaultArtifactService.java

@Loggable
@Override/*from  w  ww . j a v a  2  s.  c  o m*/
@Cacheable(value = "singleArtifact", key = "#id")
public Artifact findOne(String id) {
    Assert.hasText(id, "Id must be not null or empty!");
    return repository.findOne(id);
}

From source file:lab.mage.spring.cassandra.connector.core.CassandraSessionProvider.java

public void setAdminKeyspace(@Nonnull final String adminKeyspace) {
    Assert.notNull(adminKeyspace, "An keyspace must be given!");
    Assert.hasText(adminKeyspace, "An keyspace must be given!");
    this.adminKeyspace = adminKeyspace;
}

From source file:org.springmodules.jcr.jackrabbit.JackrabbitSessionFactory.java

/**
 * Indicate the node definition content type (by default,
 * JackrabbitNodeTypeManager#TEXT_XML).//from   ww  w.j a  v a  2s  . co  m
 * 
 * @see JackrabbitNodeTypeManager#TEXT_X_JCR_CND
 * @see JackrabbitNodeTypeManager#TEXT_XML
 * 
 * @param contentType The contentType to set.
 */
public void setContentType(String contentType) {
    Assert.hasText(contentType, "contentType is required");
    this.contentType = contentType;
}

From source file:org.cleverbus.core.reqres.RequestSendingEventNotifier.java

/**
 * Returns {@code true} if specified URI matches specified pattern.
 *
 * @param endpointURI the endpoint URI//w  ww  .java2  s .  c o  m
 * @param pattern pattern
 * @return {@code true} if specified URI matches at least one of specified patterns otherwise {@code false}
 */
static boolean filter(String endpointURI, Pattern pattern) {
    Assert.hasText(endpointURI, "the endpointURI must be defined");

    Matcher matcher = pattern.matcher(endpointURI);
    return matcher.matches();
}

From source file:fr.acxio.tools.agia.expression.StandardDataExpressionResolver.java

/**
 * Set the suffix that an expression string ends with. The default is "}".
 * // w w w  .  j  a va 2  s  . co m
 * @see #DEFAULT_EXPRESSION_SUFFIX
 */
public void setExpressionSuffix(String expressionSuffix) {
    Assert.hasText(expressionSuffix, "Expression suffix must not be empty");
    this.expressionSuffix = expressionSuffix;
}