Example usage for org.apache.commons.lang3 StringUtils isWhitespace

List of usage examples for org.apache.commons.lang3 StringUtils isWhitespace

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils isWhitespace.

Prototype

public static boolean isWhitespace(final CharSequence cs) 

Source Link

Document

Checks if the CharSequence contains only whitespace.

null will return false .

Usage

From source file:ca.nines.ise.validator.node.attribute.StringAttributeValidator.java

/**
 * Validate a string attribute./*from  w w  w .  ja  v  a 2s .co m*/
 * <p>
 * Validations performed:
 * <p>
 * <ul>
 * <li>The string must include at least one non-whitespace character.</li>
 * </ul>
 * <p>
 * @param n TagNode to validate
 * @param attr attribute to validate against
 */
@ErrorCode(code = { "validator.attribute.badstring" })
@Override
public void validate(TagNode n, Attribute attr) {
    String value = n.getAttribute(attr.getName());
    if (StringUtils.isWhitespace(value)) {
        Message m = Message.builder("validator.attribute.badstring").fromNode(n)
                .addNote("Attribute " + attr.getName() + "=\"" + value + "\" only contains whitespace.")
                .build();
        Log.addMessage(m);
    }
}

From source file:de.decoit.simu.cbor.ifmap.response.model.search.SearchResult.java

/**
 * Set the name of this search result response.
 * The name may be null to remove the name from this response.
 * If not null, the name MUST NOT be empty or whitespace only.
 *
 * @param name Search result name//  w w w .j  a  va  2s.co m
 */
public void setName(String name) {
    if (StringUtils.isWhitespace(name)) {
        throw new IllegalArgumentException("Name must not be empty or whitespace only");
    }

    this.name = name;
}

From source file:de.decoit.simu.cbor.ifmap.request.model.publish.CBORPublishDelete.java

/**
 * Set the filter string for this delete request.
 * The filter may be null to remove it from this request. If not null,
 * the filter MUST NOT be an empty string or whitespace only.
 *
 * @param filter Filter string//from www .jav a2  s  .com
 */
public void setFilter(String filter) {
    if (StringUtils.isWhitespace(filter)) {
        throw new IllegalArgumentException("Filter must not be empty or whitespace only");
    }

    this.filter = filter;
}

From source file:de.decoit.simu.cbor.ifmap.attributegroup.SearchTypeAttributeGroup.java

/**
 * Add a filter to match metadata on links to the identifier.
 * The string may be null to remove this attribute from the search. If not null,
 * the filter string MUST NOT be empty or whitespace only.
 *
 * @param matchLinks Filter string//  w  w  w .  j  a  va2 s  .  co m
 */
public void setMatchLinks(String matchLinks) {
    if (StringUtils.isWhitespace(matchLinks)) {
        throw new IllegalArgumentException("Match links must not be empty or whitespace only");
    }

    this.matchLinks = matchLinks;
}

From source file:de.decoit.simu.cbor.ifmap.response.model.CBORErrorResult.java

/**
 * Set the error string for this error reponse.
 * The string may be null to remove the error string from this response.
 * If not null, the string must not be empty or whitespace only.
 *
 * @param errorString Error string, may be null
 *//*w  ww  . j a v a2s.c om*/
public void setErrorString(String errorString) {
    if (StringUtils.isWhitespace(errorString)) {
        throw new IllegalArgumentException("Error string must not be empty or whitespace only");
    }

    this.errorString = errorString;
}

From source file:de.decoit.simu.cbor.ifmap.identifier.CBORAccessRequest.java

/**
 * Set an administrative-domain for this identity identifier.
 * The administrative-domain may be null to remove this value from the metadata. If not null,
 * the administrative-domain MUST NOT be an empty string or whitespace only.
 *
 * @param administrativeDomain administrative-domain value, may be null
 *///from  ww  w  .  ja v  a  2 s  .  c om
public void setAdministrativeDomain(final String administrativeDomain) {
    if (StringUtils.isWhitespace(administrativeDomain)) {
        throw new IllegalArgumentException("Administrative domain must not be empty or whitespace only");
    }

    this.administrativeDomain = administrativeDomain;
}

From source file:com.stratio.cassandra.lucene.schema.mapping.SingleColumnMapper.java

/**
 * Builds a new {@link SingleColumnMapper} supporting the specified types for indexing and clustering.
 *
 * @param field          The name of the field.
 * @param column         The name of the column to be mapped.
 * @param indexed        If the field supports searching.
 * @param sorted         If the field supports sorting.
 * @param analyzer       The name of the analyzer to be used.
 * @param base           The Lucene type for this mapper.
 * @param supportedTypes The supported Cassandra types for indexing.
 *//*from w  w  w  .j  av  a  2  s.  c om*/
public SingleColumnMapper(String field, String column, Boolean indexed, Boolean sorted, String analyzer,
        Class<T> base, AbstractType<?>... supportedTypes) {
    super(field, indexed, sorted, analyzer, Collections.singletonList(column == null ? field : column),
            supportedTypes);

    if (StringUtils.isWhitespace(column)) {
        throw new IndexException("Column must not be whitespace, but found '%s'", column);
    }

    this.column = column == null ? field : column;
    this.base = base;
}

From source file:de.decoit.simu.cbor.ifmap.response.model.CBORErrorResult.java

public void setName(String name) {
    if (StringUtils.isWhitespace(name)) {
        throw new IllegalArgumentException("Name must not be empty or whitespace only");
    }/*ww  w.java2  s.  c o  m*/

    this.name = name;
}

From source file:de.decoit.simu.cbor.ifmap.simu.identifier.CBORImplementation.java

/**
 * Set the local version string for this identifier.
 * The local version may be null to remove this attribute from the identifier.
 * If not null, the local version MUST NOT be empty or whitespace only.
 *
 * @param localVersion Local version string
 *///  ww w.j a va 2 s  . c o  m
public void setLocalVersion(String localVersion) {
    if (StringUtils.isWhitespace(localVersion)) {
        throw new IllegalArgumentException("Local version must not be empty or whitespace only");
    }

    if (localVersion != null) {
        DataItem localVersionDi = new UnicodeString(localVersion);
        this.attributes.put(LOCAL_VERSION, localVersionDi);
    } else {
        this.attributes.remove(LOCAL_VERSION);
    }
}

From source file:com.stratio.cassandra.lucene.schema.mapping.GeoShapeMapper.java

/**
 * Builds a new {@link GeoShapeMapper}.//from  w ww . ja va2 s  .c o  m
 *
 * @param field the name of the field
 * @param column the name of the column
 * @param validated if the field must be validated
 * @param maxLevels the maximum number of levels in the tree
 * @param transformations the sequence of operations to be applied to the specified shape
 */
public GeoShapeMapper(String field, String column, Boolean validated, Integer maxLevels,
        List<GeoTransformation> transformations) {
    super(field, column, false, validated, null, String.class, AsciiType.instance, UTF8Type.instance);

    this.column = column == null ? field : column;

    if (StringUtils.isWhitespace(column)) {
        throw new IndexException("Column must not be whitespace, but found '{}'", column);
    }

    this.maxLevels = GeospatialUtils.validateGeohashMaxLevels(maxLevels);
    SpatialPrefixTree grid = new GeohashPrefixTree(CONTEXT, this.maxLevels);
    strategy = new RecursivePrefixTreeStrategy(grid, field);

    this.transformations = (transformations == null) ? Collections.emptyList() : transformations;
}