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

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

Introduction

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

Prototype

public static String join(Collection<?> collection, String separator) 

Source Link

Document

Joins the elements of the provided Collection into a single String containing the provided elements.

Usage

From source file:co.degraph.core.utils.PathUtils.java

public static String join(Object... paths) {
    return StringUtils.join(paths, "/");
}

From source file:edu.northwestern.bioinformatics.studycalendar.security.plugin.AuthenticationSystemValidator.java

public static void validateRequiredElementsCreated(AuthenticationSystem system)
        throws AuthenticationSystemInitializationFailure {
    List<String> missing = new ArrayList<String>(3);
    if (system.authenticationManager() == null) {
        missing.add("authenticationManager()");
    }//from   www . ja va  2  s.com
    if (system.entryPoint() == null) {
        missing.add("entryPoint()");
    }
    if (!missing.isEmpty()) {
        String list = missing.get(missing.size() - 1);
        if (missing.size() >= 2) {
            list = String.format("%s or %s",
                    StringUtils.join(missing.subList(0, missing.size() - 1).iterator(), ", "), list);
        }
        throw new AuthenticationSystemInitializationFailure("%s must not return null from %s",
                system.getClass().getSimpleName(), list);
    }
}

From source file:com.jslsolucoes.tagria.lib.tag.x.StringUtil.java

public static String join(Collection<?> collection, String separator) {
    return StringUtils.join(collection, separator);
}

From source file:cn.hxh.springside.test.utils.SpringWebTestUtils.java

/**
 * ServletContext?Spring WebApplicationContext.
 * //from  w ww.j  av a 2 s .com
 * @param configLocations application context.
 */
public static void initWebApplicationContext(MockServletContext servletContext, String... configLocations) {
    String configLocationsString = StringUtils.join(configLocations, ",");
    servletContext.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, configLocationsString);
    new ContextLoader().initWebApplicationContext(servletContext);
}

From source file:de.dfki.resc28.ole.bootstrap.Util.java

public static Literal toURLEncodedStringLiteral(List<TerminalNode> tokens, String separator) {
    return ResourceFactory.createTypedLiteral(Util.urlEncoded(StringUtils.join(tokens.toArray(), separator)),
            XSDDatatype.XSDstring);//from w  ww.ja va  2  s  .c om
}

From source file:com.swtxml.util.lang.Filters.java

public static <A> IFilter<A> and(final Iterable<IFilter<A>> filters) {
    return new IFilter<A>() {
        public boolean match(A obj) {
            for (IFilter<A> filter : filters) {
                if (!filter.match(obj)) {
                    return false;
                }//www. ja  v a  2  s  .c  o m
            }
            return true;
        }

        @Override
        public String toString() {
            return "(" + StringUtils.join(filters.iterator(), " and ") + ")";
        }
    };
}

From source file:it.geosolutions.geoservertester.Utils.java

/**
 * Escapes a string duplicating apex,as cql language requires
 * @param string the string to escape//  ww  w. j av  a2  s.  co  m
 * @return the escaped string
 */
static String escapeCQLString(String string) {

    String[] components = string.split("'");
    return StringUtils.join(components, "''");
}

From source file:com.carteblanche.kwd.parsers.TestCaseParser.java

public static KWDTestCase parse(File csv, String cvsSplitBy) {

    BufferedReader br = null;/*ww w  .jav  a 2 s . c  o  m*/
    String line = "";
    String csvFile = csv.getAbsolutePath();

    try {

        File file = new File(csvFile);

        String testCaseName = file.getName();
        testCaseName = testCaseName.replace(".csv", "");
        testCaseName = StringUtils
                .capitalize(StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(testCaseName), ' '));
        br = new BufferedReader(new FileReader(csvFile));
        ArrayList<KWDTestMethod> testMethods = new ArrayList<KWDTestMethod>();
        while ((line = br.readLine()) != null) {

            // use comma as separator
            String[] columns = line.split(cvsSplitBy);

            if (columns.length < 1) {
                System.out.println("Every row should have atleast 1 Column");
                System.exit(122);
            }

            ArrayList<String> parameters = new ArrayList<String>();
            for (int i = 1; i < columns.length; i++) {
                parameters.add(columns[i]);
            }
            KWDTestMethod testMethod = new KWDTestMethod(columns[0], parameters);
            testMethod.setClasssName("com.carteblanche.kwd.tests.Login");
            testMethods.add(testMethod);
        }
        KWDTestCase testCase = new KWDTestCase(testCaseName, testMethods);
        return testCase;
        // return new KWDTestSuite(testSuiteName, testcases);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        if (br != null) {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    return null;
}

From source file:com.zb.app.external.lucene.search.utils.ZuobianSolrQueryConvert.java

public static SolrQuery to(ProductSearchQuery query) {
    List<String> params = new ArrayList<String>();
    // ?//from w w w .ja  v  a  2 s .  c  o m
    if (Argument.isNotEmpty(query.getProducts())) {
        String q = StringUtils.join(query.getProducts().toArray(new String[0]), " ");
        if (StringUtils.isNotBlank(q)) {
            params.add(q.length() == 1 ? "lTile:*" + q + "*" : filterQuery(q));
        }
    }
    // ???
    if (query.getlGroupNumber() != null && query.getlGroupNumber() != "") {
        params.add("lGroupNumber:" + query.getlGroupNumber());
    }
    // ??
    if (query.getProduct() != null && query.getProduct() != "") {
        params.add("lProduct:" + query.getProduct());
    }

    // 
    List<String> fiter = new ArrayList<String>();
    // ?
    if (query.getlType() != null && query.getlGroupNumber() != "") {
        fiter.add("lType:" + query.getlType());
    }
    // ?
    if (query.getlDay() != null && query.getlDay() != 0) {
        fiter.add("lDay:" + query.getlDay());
    }
    // ?
    if (query.getzIds() != null) {
        String paramszid = "";
        for (Long zid : query.getzIds()) {
            paramszid += "zId:" + zid + " OR ";
        }
        fiter.add("(" + paramszid.substring(0, paramszid.length() - 4) + ")");
    }
    // ?
    if (query.getlArrivalCity() != null && query.getlArrivalCity() != "") {
        fiter.add("lArrivalCity:" + query.getlArrivalCity());
    }
    SolrQuery solrQuery = createSearchQuery(params, fiter, query);
    logger.debug("ZuobianSolrQueryConvert solr query: [{}]", solrQuery.toString());
    return solrQuery;
}

From source file:com.openshift.restclient.utils.BeanUtils.java

/**
 * Convert a delimited string to camelcase (e.g. foo-bar -> fooBar) 
 * @param name      the string to convert
 * @param delimiter the delimiter to use
 * @return the delimited string camelcased
 *///from  ww w.j a  va 2s .  c  o m
public static String toCamelCase(String name, String delimiter) {
    String[] parts = name.split("-");
    List<String> capitalized = Stream.of(parts).map(p -> StringUtils.capitalize(p))
            .collect(Collectors.toList());
    return StringUtils.uncapitalize(StringUtils.join(capitalized, ""));
}