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

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

Introduction

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

Prototype

public static boolean startsWith(final CharSequence str, final CharSequence prefix) 

Source Link

Document

Check if a CharSequence starts with a specified prefix.

null s are handled without exceptions.

Usage

From source file:com.tribuo.backend.configuration.CustomAuthorizer.java

@Override
public boolean isProfileAuthorized(final WebContext context, final CommonProfile profile) {
    if (profile == null) {
        return false;
    }/*from   w  ww.  j  ava 2s . c o  m*/
    return StringUtils.startsWith(profile.getUsername(), "jle");
}

From source file:io.knotx.adapter.common.placeholders.RequestPlaceholderSubstitutor.java

@Override
public String getValue(final ClientRequest request, final String placeholder) {
    return Arrays.stream(Strategy.values())
            .filter(strategy -> StringUtils.startsWith(placeholder, strategy.prefix)).findFirst()
            .map(strategy -> strategy.getValue(request, placeholder)).orElse(null);
}

From source file:de.micromata.genome.util.i18n.OptionalTranslationProvider.java

@Override
public Object getTranslationForKey(String key) {
    if (StringUtils.startsWith(key, "%") == true) {
        String nkey = key.substring(1);
        return super.getTranslationForKey(nkey);
    }//from w w w .  jav a  2 s. c  om
    return key;
}

From source file:com.thinkbiganalytics.security.core.encrypt.EncryptionService.java

public boolean isEncrypted(String str) {
    return StringUtils.startsWith(str, CIPHER_PREFIX);
}

From source file:com.github.ferstl.depgraph.dot.AttributeBuilder.java

public AttributeBuilder label(String label) {
    if (StringUtils.startsWith(label, "<") && StringUtils.endsWith(label, ">")) {
        this.attributes.put("label", label);
        return this;
    }/*  ww w  .j a  v  a 2s.  c o  m*/

    return addAttribute("label", label);
}

From source file:com.github.ferstl.depgraph.graph.dot.DotAttributeBuilder.java

public DotAttributeBuilder label(String label) {
    if (StringUtils.startsWith(label, "<") && StringUtils.endsWith(label, ">")) {
        this.attributes.put("label", label);
        return this;
    }/*from  ww  w.j ava 2 s . c o  m*/

    return addAttribute("label", label);
}

From source file:ch.cyberduck.core.local.TildeExpander.java

public String abbreviate(final String name) {
    if (StringUtils.startsWith(name, preferences.getProperty("local.user.home"))) {
        return Local.HOME + StringUtils.removeStart(name, preferences.getProperty("local.user.home"));
    }//  w  ww . ja v  a  2s  .c om
    return name;
}

From source file:com.mirth.connect.server.util.Pre22PasswordChecker.java

/**
 * Returns true if the provided hash was generated using the pre-2.2
 * algorithm, false otherwise.// www.  j  av a2 s  .  c o m
 * 
 * @param hash
 * @return
 */
public static boolean isPre22Hash(String hash) {
    return StringUtils.startsWith(hash, SALT_PREFIX);
}

From source file:io.knotx.adapter.common.placeholders.UriPlaceholderSubstitutor.java

@Override
public String getValue(ClientRequest request, String placeholder) {
    return Arrays.stream(Strategy.values())
            .filter(strategy -> StringUtils.startsWith(placeholder, strategy.prefix)).findFirst()
            .map(strategy -> strategy.getValue(request.getPath(), placeholder)).orElse(null);
}

From source file:com.thinkbiganalytics.security.core.encrypt.EncryptionService.java

public String encrypt(String str) {
    String encrypted = null;/*from www .  j ava  2s  .com*/
    if (StringUtils.isNotBlank(str) && !isEncrypted(str)) {
        encrypted = encryptor.encrypt(str);
        if (!StringUtils.startsWith(encrypted, CIPHER_PREFIX)) {
            encrypted = CIPHER_PREFIX + encrypted;
        }
    } else {
        encrypted = str;
    }
    return encrypted;
}