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

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

Introduction

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

Prototype

public static boolean endsWith(String str, String suffix) 

Source Link

Document

Check if a String ends with a specified suffix.

Usage

From source file:org.sonar.api.compat.internal.Version.java

public static boolean isSnapshot(String version) {
    return StringUtils.endsWith(version, "SNAPSHOT");
}

From source file:org.sonar.api.config.PropertyDefinition.java

private static PropertyType fixType(String key, PropertyType type) {
    // Auto-detect passwords and licenses for old versions of plugins that
    // do not declare property types
    if (type == PropertyType.STRING) {
        if (StringUtils.endsWith(key, ".password.secured")) {
            return PropertyType.PASSWORD;
        } else if (StringUtils.endsWith(key, ".license.secured")) {
            return PropertyType.LICENSE;
        }/*from w  ww . j a  v  a  2  s.  com*/
    }
    return type;
}

From source file:org.sonar.core.classloaders.ClassLoadersCollection.java

/**
 * Establishes dependencies among ClassLoaders.
 *//*ww  w.  j a  v a2s.  c om*/
public void done() {
    for (Object o : world.getRealms()) {
        ClassRealm realm = (ClassRealm) o;
        if (!StringUtils.endsWith(realm.getId(), "-parent")) {
            String[] packagesToExport = new String[PREFIXES_TO_EXPORT.length];
            for (int i = 0; i < PREFIXES_TO_EXPORT.length; i++) {
                // important to have dot at the end of package name only for classworlds 1.1
                packagesToExport[i] = PREFIXES_TO_EXPORT[i] + realm.getId() + ".api";
            }
            export(realm, packagesToExport);
        }
    }
}

From source file:org.sonar.core.classloaders.ClassLoadersCollection.java

private boolean isResource(URL url) {
    String path = url.getPath();//  ww  w.  ja v a 2s.c  o m
    return !StringUtils.endsWith(path, ".jar") && !StringUtils.endsWith(path, "/");
}

From source file:org.sonar.core.classloaders.ResourcesClassLoader.java

@Override
public URL findResource(String name) {
    for (URL url : urls) {
        if (StringUtils.endsWith(url.getPath(), name)) {
            return url;
        }//from www .j ava 2s.c  o  m
    }
    return null;
}

From source file:org.sonar.core.i18n.RuleI18nManager.java

static boolean isRuleProperty(String propertyKey) {
    return StringUtils.startsWith(propertyKey, RULE_PREFIX) && StringUtils.endsWith(propertyKey, NAME_SUFFIX)
            && !propertyKey.contains(".param.");
}

From source file:org.sonar.core.plugins.PluginClassloaders.java

/**
 * Establishes dependencies among ClassLoaders.
 */// w  w w .ja  v a2 s. c  o m
public void done() {
    if (done) {
        throw new IllegalStateException("Plugin classloaders are already initialized");
    }
    for (Object o : world.getRealms()) {
        ClassRealm realm = (ClassRealm) o;
        if (!StringUtils.endsWith(realm.getId(), "-parent")) {
            String[] packagesToExport = new String[PREFIXES_TO_EXPORT.length];
            for (int i = 0; i < PREFIXES_TO_EXPORT.length; i++) {
                // important to have dot at the end of package name only for classworlds 1.1
                packagesToExport[i] = PREFIXES_TO_EXPORT[i] + realm.getId() + ".api";
            }
            export(realm, packagesToExport);
        }
    }
    done = true;
}

From source file:org.sonar.dotnet.tools.commons.visualstudio.VisualStudioWebProject.java

/**
 * @return the generated web dlls/*www.  j  a  va 2  s .com*/
 * 
 */
public Set<File> getGeneratedAssemblies(String buildConfigurations) {
    Set<File> result = new HashSet<File>();

    // we need to exclude all the dll files
    // that correspond to references
    Set<String> exclusions = new HashSet<String>();
    Set<File> references = getReferences();
    for (File file : references) {
        exclusions.add(file.getName());
    }

    File precompilationDirectory = getWebPrecompilationDirectory(buildConfigurations);
    if (precompilationDirectory != null && precompilationDirectory.isDirectory()) {
        File[] files = precompilationDirectory.listFiles();
        for (File file : files) {
            String name = file.getName();
            if (StringUtils.endsWith(name, "dll") && !exclusions.contains(name)) {
                result.add(file);
            }
        }
    }

    return result;
}

From source file:org.sonar.dotnet.tools.commons.visualstudio.VisualStudioWebProject.java

/**
 * @return the dll files that correspond to VS references
 *///from   www.  j  av a2 s  .  c  o m
public Set<File> getReferences() {
    File binDirectory = new File(getDirectory(), "Bin");
    Set<File> result = new HashSet<File>();
    if (binDirectory.exists()) {
        File[] files = binDirectory.listFiles();
        for (File file : files) {
            String name = file.getName();
            if (StringUtils.endsWith(name, "dll")) {
                result.add(file);
            }
        }
    }
    return result;
}

From source file:org.sonar.java.ast.check.CommentedOutCodeLineCheck.java

private boolean isJSNI(TextBlock comment) {
    String[] lines = comment.getText();
    String firstLine = lines[0];/*from ww w .  j ava2 s . c om*/
    String lastLine = lines[lines.length - 1];
    return StringUtils.startsWith(firstLine, START_JSNI) && StringUtils.endsWith(lastLine, END_JSNI);
}