Example usage for org.apache.wicket.util.string Strings beforeFirst

List of usage examples for org.apache.wicket.util.string Strings beforeFirst

Introduction

In this page you can find the example usage for org.apache.wicket.util.string Strings beforeFirst.

Prototype

public static String beforeFirst(final String s, final char c) 

Source Link

Document

Returns everything before the first occurrence of the given character in s.

Usage

From source file:com.gfactor.web.wicket.loader.OsgiClassResolver.java

License:Apache License

private List<String> getExportedPackages(Bundle bundle) {
    String exportedString = (String) bundle.getHeaders().get("Export-Package");
    if (Strings.isEmpty(exportedString))
        return Collections.emptyList();

    String[] splitted = Strings.split(exportedString, ',');
    if (splitted == null || splitted.length == 0)
        return Collections.emptyList();

    List<String> packages = new ArrayList<String>();
    for (String s : splitted) {
        String pkg = null;/*w  w  w .  j  a v a  2s .co  m*/
        if (s.contains(";"))
            pkg = Strings.beforeFirst(s, ';').trim();
        else
            pkg = s.trim();

        if (pkg != null && pkg.length() > 0)
            packages.add(pkg);
    }

    return packages;
}