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.vmware.photon.controller.api.frontend.config.ConfigurationUtils.java

public static ApiFeConfiguration parseConfiguration(String filename)
        throws IOException, ConfigurationException {
    ObjectMapper objectMapper = Jackson.newObjectMapper(new YAMLFactory());
    ValidatorFactory validatorFactory = Validation.byProvider(HibernateValidator.class).configure()
            .addValidatedValueHandler(new OptionalValidatedValueUnwrapper()).buildValidatorFactory();
    final ConfigurationFactory<ApiFeStaticConfiguration> configurationFactory = new DefaultConfigurationFactoryFactory<ApiFeStaticConfiguration>()
            .create(ApiFeStaticConfiguration.class, validatorFactory.getValidator(), objectMapper, "dw");
    checkArgument(StringUtils.isNotBlank(filename), "filename cannot be blank");
    final File file = new File(filename);
    if (!file.exists()) {
        throw new FileNotFoundException("File " + file + " not found");
    }/* w  w  w.j a  va2s  . c o m*/
    return configurationFactory.build(file);
}

From source file:jfix.util.Urls.java

/**
 * Check is given url is valid for given encoding (= url needs no encoding).
 *//*from   ww w .  j  a v  a 2s .  c  om*/
public static boolean isValid(String url, String enc) {
    return StringUtils.isNotBlank(url) && url.equals(Urls.encode(url, enc));
}

From source file:android.databinding.tool.processing.ScopedErrorReport.java

public boolean isValid() {
    return StringUtils.isNotBlank(mFilePath);
}

From source file:jease.cms.service.Imports.java

public static void fromFile(final java.io.File file, final Node parent, final User editor) throws Exception {
    if (MimeTypes.guessContentTypeFromName(file.getName()).equals("application/zip")) {
        final StringBuilder errors = new StringBuilder();
        Zipfiles.unzip(file, new EntryHandler() {
            public void process(String path, String entryName, InputStream inputStream) throws Exception {
                try {
                    if (StringUtils.isNotBlank(path)) {
                        makeFolders(parent, path, editor);
                    }//from  w  w  w.  j a v a2s  . c o  m
                    if (inputStream != null) {
                        Imports.fromInputStream(entryName, inputStream, parent.getChild(Filenames.asId(path)),
                                editor);
                    }
                } catch (NodeException e) {
                    errors.append(e.getMessage()).append(": ").append(path).append("/").append(entryName)
                            .append("\n");
                }
            }
        });
        if (errors.length() != 0) {
            throw new Exception(errors.toString());
        }
    } else {
        InputStream inputStream = new FileInputStream(file);
        Imports.fromInputStream(file.getName(), inputStream, parent, editor);
        inputStream.close();
    }
}

From source file:br.com.gerenciapessoal.repository.Bancos.java

public List<Banco> filtrados(BancoFilter filter) {
    Session session = manager.unwrap(Session.class);
    Criteria criteria = session.createCriteria(Banco.class);

    if (StringUtils.isNotBlank(filter.getNumBanco())) {
        criteria.add(Restrictions.eq("numBanco", filter.getNumBanco()));
    }//w  ww  .ja va 2  s  .com

    if (StringUtils.isNotBlank(filter.getNome())) {
        criteria.add(Restrictions.ilike("nome", filter.getNome(), MatchMode.ANYWHERE));
    }

    if (StringUtils.isNotBlank(filter.getUf())) {
        criteria.add(Restrictions.ilike("uf", filter.getUf(), MatchMode.ANYWHERE));
    }

    if (StringUtils.isNotBlank(filter.getEstado())) {
        criteria.add(Restrictions.ilike("estado", filter.getEstado(), MatchMode.ANYWHERE));
    }

    if (StringUtils.isNotBlank(filter.getEndereco())) {
        criteria.add(Restrictions.ilike("endereco", filter.getEndereco(), MatchMode.ANYWHERE));
    }

    return criteria.addOrder(Order.asc("numBanco")).list();
}

From source file:de.blizzy.documentr.markdown.MacroInvocationTest.java

@Test
public void getEndMarker() {
    assertTrue(StringUtils.isNotBlank(invocation.getEndMarker()));
}

From source file:com.nike.vault.client.auth.EnvironmentVaultCredentialsProvider.java

/**
 * Attempts to acquire credentials from an environment variable.
 *
 * @return credentials//from   ww w . ja  v  a  2 s.c  o  m
 */
@Override
public VaultCredentials getCredentials() {
    final String token = System.getenv(VAULT_TOKEN_ENV_PROPERTY);

    if (StringUtils.isNotBlank(token)) {
        return new TokenVaultCredentials(token);
    }

    throw new VaultClientException("Vault token not found in the environment property.");
}

From source file:ch.cyberduck.core.DefaultPathPredicate.java

public String attributes() {
    String qualifier = StringUtils.EMPTY;
    if (StringUtils.isNotBlank(file.attributes().getRegion())) {
        if (containerService.isContainer(file)) {
            qualifier += file.attributes().getRegion();
        }//from   www.  j a  v  a2 s  .co m
    }
    if (file.isFile()) {
        if (StringUtils.isNotBlank(file.attributes().getVersionId())) {
            qualifier += file.attributes().getVersionId();
        }
    }
    return qualifier;
}

From source file:com.nike.vault.client.auth.SystemPropertyVaultCredentialsProvider.java

/**
 * Attempts to acquire credentials from an java system property.
 *
 * @return credentials//  ww  w.  j  av  a2  s .com
 */
@Override
public VaultCredentials getCredentials() {
    final String token = System.getProperty(VAULT_TOKEN_SYS_PROPERTY);

    if (StringUtils.isNotBlank(token)) {
        return new TokenVaultCredentials(token);
    }

    throw new VaultClientException("Vault token not found in the java system property.");
}

From source file:com.connio.sdk.request.device.DeviceFetchRequest.java

@Override
protected Request request() {
    final String deviceIdentificator = (StringUtils.isNotBlank(deviceId) ? deviceId : "_this_");
    final String path = "devices/" + deviceIdentificator;
    return Request.get(path);
}