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

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

Introduction

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

Prototype

public static boolean startsWith(String str, String prefix) 

Source Link

Document

Check if a String starts with a specified prefix.

Usage

From source file:org.jboss.windup.decorator.java.JavaASTVariableResolvingVisitor.java

private boolean lineContainsPackageBlacklist(String line) {
    for (String black : this.classBlacklists) {
        black = StringUtils.substringBeforeLast(black, ".");

        if (StringUtils.startsWith(line, black)) {
            return true;
        }/*from w ww  . j  a v  a  2 s.c o  m*/
    }
    return false;
}

From source file:org.jboss.windup.decorator.java.JavaASTVariableResolvingVisitor.java

private boolean lineContainsClassBlacklist(String line) {
    for (String black : this.classBlacklists) {
        if (StringUtils.startsWith(line, black)) {
            return true;
        }/*from  ww  w  .  j  a  v  a 2s  . c o m*/
    }
    return false;
}

From source file:org.jboss.windup.decorator.JspDecorator.java

public void setClassBlacklists(List<String> classBls) {
    if (classBls == null)
        return;/*from w  w  w.j  a  v a  2 s .c  om*/

    this.classBlacklistPatterns = new HashSet<Pattern>(classBls.size());
    for (String classBlacklist : classBls) {
        if (!StringUtils.startsWith(classBlacklist, "^")) {
            classBlacklist = "^" + classBlacklist;
        }
        this.classBlacklistPatterns.add(Pattern.compile(classBlacklist));
    }
}

From source file:org.jboss.windup.decorator.JspDecorator.java

public void setNamespaceBlacklists(List<String> namespaceBls) {
    if (namespaceBls == null)
        return;/*w ww.j av a 2 s  . com*/

    this.namespaceBlacklistPatterns = new HashSet<Pattern>(namespaceBls.size());
    for (String namespaceBlacklist : namespaceBls) {
        if (!StringUtils.startsWith(namespaceBlacklist, "^")) {
            namespaceBlacklist = "^" + namespaceBlacklist;
        }
        this.namespaceBlacklistPatterns.add(Pattern.compile(namespaceBlacklist));
    }
}

From source file:org.jboss.windup.interrogator.util.KnownArchiveProfiler.java

protected Map<Pattern, String> compilePatternSet(Map<String, String> patternStringSet) {
    if (patternStringSet == null)
        return null;

    Map<Pattern, String> target = new HashMap<Pattern, String>(patternStringSet.size());
    for (String patternString : patternStringSet.keySet()) {
        String patternVal = patternStringSet.get(patternString);

        if (!StringUtils.startsWith(patternString, "^")) {
            patternString = "^" + patternString;
        }/*from w  w w . j  ava 2  s.  co  m*/

        target.put(Pattern.compile(patternString), patternVal);
    }

    return target;
}

From source file:org.jboss.windup.util.CustomerPackageResolver.java

public boolean isCustomerPkg(String className) {
    for (String excludePackage : excludePackages) {
        if (StringUtils.startsWith(className, excludePackage)) {
            return false;
        }//from  ww  w  . j a v a  2 s.com
    }

    for (String customerPackage : customerPackages) {
        if (StringUtils.startsWith(className, customerPackage)) {
            return true;
        }
    }
    return false;
}

From source file:org.jdto.impl.BeanPropertyUtils.java

/**
 * Remove the accessor prefix from name and the bean capitalization.
 * This can be used by getters and setters.
 * @param method//w w  w.  j  av  a2 s  .  c  om
 * @return 
 */
private static String convertToPropertyName(Method method) {
    String methodName = method.getName();

    if (StringUtils.startsWith(methodName, "set")) {
        methodName = StringUtils.removeStart(methodName, "set");
    } else if (StringUtils.startsWith(methodName, "is")) {
        methodName = StringUtils.removeStart(methodName, "is");
    } else if (StringUtils.startsWith(methodName, "get")) {
        methodName = StringUtils.removeStart(methodName, "get");
    }

    //remove the first capital
    return StringUtils.uncapitalize(methodName);
}

From source file:org.jdto.tools.AnnotationConfigVerifier.java

private boolean elementIsRelevant(Element enclElement) {

    if (enclElement.getKind() != ElementKind.METHOD) {
        return false;
    }// ww w .  ja  v a2 s  .c  o m

    String strRep = enclElement.getSimpleName().toString();

    if (StringUtils.startsWith(strRep, "get") || StringUtils.startsWith(strRep, "is")) {
        return true;
    }

    return false;
}

From source file:org.jenkinsmvn.jenkins.mvn.plugin.handler.HandlerUtils.java

public Map<String, String> createParameters(Action action, String prefix) {
    Map<String, String> parameters = new HashMap<String, String>();

    if (MapUtils.isEmpty(action.getProperties())) {
        return null;
    }/*from w ww.  j a v a  2 s.  c o  m*/

    for (Map.Entry<Object, Object> entry : action.getProperties().entrySet()) {
        String name = StringUtils.trim(String.valueOf(entry.getKey()));
        String value = StringUtils.trim(String.valueOf(entry.getValue()));

        if (StringUtils.startsWith(name, prefix)) {
            String paramName = name.substring(prefix.length());
            parameters.put(paramName, value);
        }
    }

    if (MapUtils.isEmpty(parameters)) {
        return null;
    }

    return parameters;
}

From source file:org.jfrog.bamboo.context.AbstractBuildContext.java

public static AbstractBuildContext createContextFromMap(Map<String, String> map) {
    if (map == null || map.isEmpty()) {
        throw new IllegalArgumentException("No empty map allowed");
    }//w ww .j a v a2s .c o  m
    String value = getBuilderValue(map);
    if (StringUtils.isBlank(value)) {
        return null;
    }
    if (StringUtils.startsWith(value, GradleBuildContext.PREFIX)) {
        return new GradleBuildContext(sanitizeEntries(map));
    } else if (StringUtils.startsWith(value, Maven3BuildContext.PREFIX)) {
        return new Maven3BuildContext(sanitizeEntries(map));
    }
    return null;
}