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

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

Introduction

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

Prototype

public static boolean isNotBlank(final CharSequence cs) 

Source Link

Document

Checks if a CharSequence is not empty (""), not null and not whitespace only.

 StringUtils.isNotBlank(null)      = false StringUtils.isNotBlank("")        = false StringUtils.isNotBlank(" ")       = false StringUtils.isNotBlank("bob")     = true StringUtils.isNotBlank("  bob  ") = true 

Usage

From source file:com.payu.sdk.model.TransactionIntegrationMethod.java

/**
 * Tries to convert the String parameter to a {@link TransactionIntegrationMethod}
 *
 * @param integrationMethod The string to convert
 * @return it's corresponding {@link TransactionIntegrationMethod}
 *///from  www  . j av  a  2 s .  c  o  m
public static TransactionIntegrationMethod fromString(final String integrationMethod) {

    if (StringUtils.isNotBlank(integrationMethod)) {
        for (final TransactionIntegrationMethod method : TransactionIntegrationMethod.values()) {

            if (integrationMethod.equalsIgnoreCase(method.toString())) {
                return method;
            }
        }
    }
    return null;
}

From source file:com.log4ic.compressor.utils.HttpUtils.java

public static boolean isHttpProtocol(String url) {
    return StringUtils.isNotBlank(url) && (url.startsWith("http://") || url.startsWith("https://"));
}

From source file:de.blizzy.documentr.web.util.FacadeHostRequestWrapper.java

public static String buildFacadeUrl(String url, String contextPath, String documentrHost) {
    contextPath = StringUtils.defaultIfBlank(contextPath, StringUtils.EMPTY);
    if (contextPath.equals("/")) { //$NON-NLS-1$
        contextPath = StringUtils.EMPTY;
    }/*from  w ww.j  av  a  2s.c  om*/

    String newUrl;
    if (StringUtils.isNotBlank(contextPath)) {
        int pos = url.indexOf(contextPath);
        newUrl = documentrHost + url.substring(pos + contextPath.length());
    } else {
        UriComponentsBuilder builder;
        try {
            builder = UriComponentsBuilder.fromHttpUrl(url);
        } catch (IllegalArgumentException e) {
            builder = UriComponentsBuilder.fromUriString(url);
        }
        String path = StringUtils.defaultIfBlank(builder.build().getPath(), StringUtils.EMPTY);
        if (StringUtils.isNotBlank(path)) {
            int pos = StringUtils.lastIndexOf(url, path);
            newUrl = documentrHost + url.substring(pos);
        } else {
            newUrl = documentrHost;
        }
    }
    return newUrl;
}

From source file:com.mirth.connect.client.ui.components.rsta.ac.js.MirthJavaScriptFunctionCompletion.java

public MirthJavaScriptFunctionCompletion(CompletionProvider provider, FunctionReference reference) {
    super(provider, reference);
    constructor = reference instanceof ConstructorReference;
    if (StringUtils.isNotBlank(reference.getSummary())) {
        setSummary(reference.getSummary());
    }//  w  ww.ja va2  s .  co m
}

From source file:cherry.foundation.validator.NotBlankValidator.java

@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
    return StringUtils.isNotBlank(value);
}

From source file:be.wegenenverkeer.common.resteasy.json.LocalDateDeserializer.java

@Override
protected LocalDate _deserialize(String value, DeserializationContext ctxt) throws IOException {
    if (StringUtils.isNotBlank(value)) {
        return iso8601AndOthers.parse(value);
    }//www  .  jav  a  2s  .  c o  m
    return null; // empty string
}

From source file:jfix.zk.Fileupload.java

public void setUploadLimit(String limit) {
    if (StringUtils.isNotBlank(limit)) {
        setUpload("true,maxsize=" + limit);
    }
}

From source file:io.wcm.dam.assetservice.impl.DamPathHandler.java

private static Set<String> validateDamPaths(String[] damPaths) {
    Set<String> paths = new HashSet<>();
    if (damPaths != null) {
        for (String path : damPaths) {
            if (StringUtils.isNotBlank(path)) {
                paths.add(path);//from ww w . j a v a  2  s  . com
            }
        }
    }
    if (paths.isEmpty()) {
        paths.add(DEFAULT_DAM_PATH);
    }
    return ImmutableSet.copyOf(paths);
}

From source file:com.omertron.omdbapi.tools.Param.java

/**
 * Convert a string into an Enum type// ww w  .jav  a 2 s . c o  m
 *
 * @param value
 * @return
 */
public static Param fromString(String value) {
    if (StringUtils.isNotBlank(value)) {
        for (final Param param : EnumSet.allOf(Param.class)) {
            if (value.equalsIgnoreCase(param.value)) {
                return param;
            }
        }
    }

    // We've not found the type!
    throw new IllegalArgumentException("Value '" + value + "' not recognised");
}

From source file:com.labs64.mojo.swid.configuration.RegId.java

public String getUnique_id() {
    if (StringUtils.isBlank(unique_id) && StringUtils.isNotBlank(name)) {
        return name;
    }/*from   w w w  . ja v a 2s . c o m*/
    return unique_id;
}