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

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

Introduction

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

Prototype

public static String join(final Iterable<?> iterable, final String separator) 

Source Link

Document

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

No delimiter is added before or after the list.

Usage

From source file:edu.umich.flowfence.testapp.TestQM.java

private static void trace(String method, Object... args) {
    //Log.i(TAG, String.format("%s()", method));
    Log.i(TAG, String.format("%s(%s)", method, StringUtils.join(args, ", ")));
}

From source file:io.cloudslang.lang.compiler.Extension.java

public static String getExtensionValuesAsString() {
    return StringUtils.join(extensionValues, ", ");
}

From source file:com.microsoft.azure.shortcuts.resources.samples.ProvidersSample.java

public static void test(Subscription subscription) throws Exception {
    // List provider namespaces
    Map<String, Provider> providers = subscription.providers().asMap();
    System.out/*from   w  w  w .ja v a 2s  .co m*/
            .println(String.format("Provider namespaces: %s\t", StringUtils.join(providers.keySet(), "\n\t")));

    // List providers
    for (Provider provider : providers.values()) {
        System.out.println(provider.id() + " - " + provider.registrationState());
    }

    if (providers.size() > 0) {
        // Get information about a specific provider
        Provider provider = subscription.providers("microsoft.classicstorage");

        System.out.println(String.format(
                "Found provider: %s\n" + "\tRegistration State: %s\n" + "\tAPI versions for resource types:",
                provider.id(), provider.registrationState()));

        for (ResourceType t : provider.resourceTypes().values()) {
            System.out.println(String.format("\t\t%s: %s", t.id(), StringUtils.join(t.apiVersions(), ", ")));
        }

        // Get latest API version for a specific resource type
        String resourceType = "storageAccounts";
        System.out.println(String.format("\n\t\tLatest version for type %s: %s", resourceType,
                provider.resourceTypes().get(resourceType).latestApiVersion()));

        // Get latest API version for a specific resource type - shortcut
        System.out.println(String.format("\n\t\tLatest version for type %s: %s", resourceType,
                provider.resourceTypes(resourceType).latestApiVersion()));
    }
}

From source file:com.l2jfree.gameserver.util.TableOptimizer.java

public static void optimize() {
    Connection con = null;//from   w w  w. j  a v  a  2s.  c  om
    try {
        con = L2DatabaseFactory.getInstance().getConnection();
        Statement st = con.createStatement();

        final ArrayList<String> tables = new ArrayList<String>();
        {
            ResultSet rs = st.executeQuery("SHOW FULL TABLES");
            while (rs.next()) {
                String tableType = rs.getString(2/*"Table_type"*/);

                if (tableType.equals("VIEW"))
                    continue;

                tables.add(rs.getString(1));
            }
            rs.close();
        }

        {
            ResultSet rs = st.executeQuery("CHECK TABLE " + StringUtils.join(tables, ","));
            while (rs.next()) {
                String table = rs.getString("Table");
                String msgType = rs.getString("Msg_type");
                String msgText = rs.getString("Msg_text");

                if (msgType.equals("status"))
                    if (msgText.equals("OK"))
                        continue;

                _log.warn("TableOptimizer: CHECK TABLE " + table + ": " + msgType + " -> " + msgText);
            }
            rs.close();

            _log.info("TableOptimizer: Database tables have been checked.");
        }

        {
            ResultSet rs = st.executeQuery("ANALYZE TABLE " + StringUtils.join(tables, ","));
            while (rs.next()) {
                String table = rs.getString("Table");
                String msgType = rs.getString("Msg_type");
                String msgText = rs.getString("Msg_text");

                if (msgType.equals("status"))
                    if (msgText.equals("OK") || msgText.equals("Table is already up to date"))
                        continue;

                _log.warn("TableOptimizer: ANALYZE TABLE " + table + ": " + msgType + " -> " + msgText);
            }
            rs.close();

            _log.info("TableOptimizer: Database tables have been analyzed.");
        }

        {
            ResultSet rs = st.executeQuery("OPTIMIZE TABLE " + StringUtils.join(tables, ","));
            while (rs.next()) {
                String table = rs.getString("Table");
                String msgType = rs.getString("Msg_type");
                String msgText = rs.getString("Msg_text");

                if (msgType.equals("status"))
                    if (msgText.equals("OK") || msgText.equals("Table is already up to date"))
                        continue;

                if (msgType.equals("note"))
                    if (msgText.equals("Table does not support optimize, doing recreate + analyze instead"))
                        continue;

                _log.warn("TableOptimizer: OPTIMIZE TABLE " + table + ": " + msgType + " -> " + msgText);
            }
            rs.close();

            _log.info("TableOptimizer: Database tables have been optimized.");
        }
        st.close();
    } catch (Exception e) {
        _log.warn("TableOptimizer: Cannot optimize database tables!", e);
    } finally {
        L2DatabaseFactory.close(con);
    }
}

From source file:com.techcavern.wavetact.ircCommands.fun.Prism.java

@Override
public void onCommand(User user, PircBotX network, String prefix, Channel channel, boolean isPrivate,
        int userPermLevel, String... args) throws Exception {
    String prism = "";
    for (char c : StringUtils.join(args, " ").replace("\n", " ").toCharArray()) {
        prism += IRCUtils.prism(c);//  w ww .j  a va  2s.  co m
    }
    IRCUtils.sendMessage(user, network, channel, prism, prefix);
}

From source file:com.github.rvesse.airline.TestPing.java

private void ping(String... args) {
    System.out.println("$ ping " + StringUtils.join(args, ' '));
    Ping.main(args);//from   ww w.  ja v a  2 s .c o m
    System.out.println();
}

From source file:com.norconex.commons.wicket.markup.html.chart.jqplot.Series.java

@SuppressWarnings("nls")
@Override//from   w  ww  .jav a  2s.com
public String toString() {
    return "[" + StringUtils.join(this, ", ") + "]";
}

From source file:io.github.robwin.swagger2markup.utils.PropertyUtils.java

public static String getType(Property property, MarkupLanguage markupLanguage) {
    Validate.notNull(property, "property must not be null!");
    String type;/* w  w  w.  ja v a  2  s.  c  o m*/
    if (property instanceof RefProperty) {
        RefProperty refProperty = (RefProperty) property;
        switch (markupLanguage) {
        case ASCIIDOC:
            return "<<" + refProperty.getSimpleRef() + ">>";
        default:
            return refProperty.getSimpleRef();
        }
    } else if (property instanceof ArrayProperty) {
        ArrayProperty arrayProperty = (ArrayProperty) property;
        Property items = arrayProperty.getItems();
        type = getType(items, markupLanguage) + " " + arrayProperty.getType();
    } else if (property instanceof StringProperty) {
        StringProperty stringProperty = (StringProperty) property;
        List<String> enums = stringProperty.getEnum();
        if (CollectionUtils.isNotEmpty(enums)) {
            type = "enum" + " (" + StringUtils.join(enums, ", ") + ")";
        } else {
            type = property.getType();
        }
    } else {
        if (StringUtils.isNotBlank(property.getFormat())) {
            type = StringUtils.defaultString(property.getType()) + " (" + property.getFormat() + ")";
        } else {
            type = property.getType();
        }
    }
    return StringUtils.defaultString(type);
}

From source file:com.mirth.connect.connectors.smtp.DefaultSmtpConfiguration.java

@Override
public void configureConnectorDeploy(Connector connector) {
    protocols = StringUtils.join(
            MirthSSLUtil.getEnabledHttpsProtocols(configurationController.getHttpsClientProtocols()), ' ');
    cipherSuites = StringUtils.join(//from  ww  w. j av  a2s  . c o m
            MirthSSLUtil.getEnabledHttpsCipherSuites(configurationController.getHttpsCipherSuites()), ' ');
}

From source file:it.attocchi.utils.StringFunc.java

public static String writeLines(List<String> lines, String defaultValueIfEmpty) {
    String res = defaultValueIfEmpty;

    if (ListUtils.isNotEmpty(lines))
        res = StringUtils.join(lines.toArray(), NEW_LINE);

    return res;// w  ww  . j av a 2s.co  m
}