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:com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorDto.java

private String extractMessages(OperationExecutionType execution) {
    List<String> messages = new ArrayList<>();
    for (ObjectDeltaOperationType deltaOperation : execution.getOperation()) {
        OperationResultType result = deltaOperation.getExecutionResult();
        if (result == null || result.getMessage() == null) {
            continue;
        }/* ww  w.ja  v  a  2 s .co  m*/
        OperationResultStatusType status = result.getStatus();
        if (status != OperationResultStatusType.WARNING && status != OperationResultStatusType.FATAL_ERROR
                && status != OperationResultStatusType.PARTIAL_ERROR) {
            continue;
        }
        messages.add(result.getMessage());
    }
    return StringUtils.join(messages, "; ");
}

From source file:ee.ria.xroad.common.ExpectedCodedException.java

private static String join(String[] parts) {
    if (parts == null || parts.length == 0 || parts[0] == null) {
        return null;
    }/*from ww w .  j a v  a 2  s.  co m*/
    return StringUtils.join(parts, ".");
}

From source file:annis.visualizers.htmlvis.VisParser.java

public VisParser(InputStream inStream) throws IOException, VisParserException {
    this.definitions = new LinkedList<VisualizationDefinition>();

    HTMLVisConfigLexer lexer = new HTMLVisConfigLexer(new ANTLRInputStream(inStream));
    HTMLVisConfigParser parser = new HTMLVisConfigParser(new CommonTokenStream(lexer));

    final List<String> errors = new LinkedList<String>();

    parser.removeErrorListeners();// ww  w  . j ava2s . c om
    parser.addErrorListener(new BaseErrorListener() {

        @Override
        public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line,
                int charPositionInLine, String msg, RecognitionException e) {
            errors.add("line " + line + ":" + charPositionInLine + " " + msg);
        }

    });

    ParseTree tree = parser.start();
    if (errors.isEmpty()) {
        ParseTreeWalker walker = new ParseTreeWalker();
        walker.walk((VisParser) this, tree);
    } else {
        throw new VisParserException("Parser error:\n" + StringUtils.join(errors, "\n"));
    }
}

From source file:eu.delving.x3ml.TestCoinA.java

@Test
public void test02Join() {
    X3MLEngine engine = engine("/coin_a/02-join.x3ml");
    X3MLEngine.Output output = engine.execute(document("/coin_a/02-coin-input.xml"),
            X3MLGeneratorPolicy.load(null, X3MLGeneratorPolicy.createUUIDSource(2)));
    //        output.writeXML(System.out);
    String[] mappingResult = output.toStringArray();
    String[] expectedResult = xmlToNTriples("/coin_a/02-join-rdf.xml");
    List<String> diff = compareNTriples(expectedResult, mappingResult);
    assertTrue("\n" + StringUtils.join(diff, "\n") + "\n", errorFree(diff));
}

From source file:com.gammalabs.wifianalyzer.wifi.ChannelAvailableAdapter.java

@NonNull
@Override/*from w w w .  j av  a 2s  .c o  m*/
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
    View view = convertView;
    if (view == null) {
        LayoutInflater layoutInflater = MainContext.INSTANCE.getMainActivity().getLayoutInflater();
        view = layoutInflater.inflate(R.layout.channel_available_details, parent, false);
    }
    WiFiChannelCountry wiFiChannelCountry = getItem(position);
    ((TextView) view.findViewById(R.id.channel_available_country))
            .setText(wiFiChannelCountry.getCountryCode() + " - " + wiFiChannelCountry.getCountryName());
    ((TextView) view.findViewById(R.id.channel_available_title_ghz_2))
            .setText(String.format(Locale.ENGLISH, "%s : ", WiFiBand.GHZ2.getBand()));
    ((TextView) view.findViewById(R.id.channel_available_ghz_2))
            .setText(StringUtils.join(wiFiChannelCountry.getChannelsGHZ2().toArray(), ","));
    ((TextView) view.findViewById(R.id.channel_available_title_ghz_5))
            .setText(String.format(Locale.ENGLISH, "%s : ", WiFiBand.GHZ5.getBand()));
    ((TextView) view.findViewById(R.id.channel_available_ghz_5))
            .setText(StringUtils.join(wiFiChannelCountry.getChannelsGHZ5().toArray(), ","));
    return view;
}

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

public static void testProvisionMinimal(Subscription subscription) throws Exception {
    String suffix = String.valueOf(System.currentTimeMillis());
    String newNICName = "nic" + suffix;
    NetworkInterface nic = subscription.networkInterfaces().define(newNICName).withRegion(Region.US_WEST)
            .withNewResourceGroup().withNewNetwork("10.0.0.0/28").withPrivateIpAddressDynamic()
            .withoutPublicIpAddress().create();

    String newGroupName = nic.resourceGroup();
    nic = subscription.networkInterfaces().get(nic.id());
    printNetworkInterface(nic);/*from www . jav a  2 s. c  o m*/

    // Listing all network interfaces
    Map<String, NetworkInterface> nics = subscription.networkInterfaces().asMap();
    System.out.println("Network interfaces:");
    for (NetworkInterface n : nics.values()) {
        printNetworkInterface(n);
    }

    // Listing network interfaces in a specific resource group
    nics = subscription.networkInterfaces().asMap(newGroupName);
    System.out.println(String.format("Network interface ids in group '%s': \n\t%s", newGroupName,
            StringUtils.join(nics.keySet(), ",\n\t")));

    nic.delete();
}

From source file:com.github.kubernetes.java.client.model.Manifest.java

@Override
public String toString() {
    return "Manifest [version=" + version + ", id=" + id + ", containers=" + StringUtils.join(containers, ",")
            + ", volumes=" + StringUtils.join(volumes, ",") + "]";
}

From source file:cn.guoyukun.spring.web.filter.DebugRequestAndResponseFilter.java

private void debugRequest(HttpServletRequest request) {
    log.debug("=====================request begin==========================");
    String uri = request.getRequestURI();
    String queryString = request.getQueryString();
    if (StringUtils.isNotBlank(queryString)) {
        uri = uri + "?" + queryString;
    }//from  w  w w  .ja v a  2 s. com
    log.debug("{}:{}", request.getMethod(), uri);
    log.debug("remote ip:{}  sessionId:{}  ", IpUtils.getIpAddr(request), request.getRequestedSessionId());
    log.debug("===header begin============================================");
    Enumeration<String> headerNames = request.getHeaderNames();
    while (headerNames.hasMoreElements()) {
        String name = headerNames.nextElement();
        String value = headersToString(request.getHeaders(name));
        log.debug("{}={}", name, value);
    }
    log.debug("===header   end============================================");
    log.debug("===parameter begin==========================================");
    Enumeration<String> parameterNames = request.getParameterNames();
    while (parameterNames.hasMoreElements()) {
        String name = parameterNames.nextElement();
        String value = StringUtils.join(request.getParameterValues(name), "||");
        log.debug("{}={}", name, value);
    }
    log.debug("===parameter   end==========================================");
    log.debug("=====================request   end==========================");
}

From source file:cc.kave.commons.model.groum.comparator.Path.java

@Override
public String toString() {
    return "(" + StringUtils.join(path, "-") + ")";
}

From source file:com.threewks.thundr.http.URLEncoder.java

/**
 * Encodes the given query parameters into the query string such that it returns <code>?param1=value1&param2=value2&....</code>.
 * //from  w ww .j ava 2s  .  co m
 * Uses toString on parameters to determine their string representation.
 * Returns an empty string if no parameters are provided.
 * 
 * @param parameters
 * @return
 */
public static final String encodeQueryString(Map<String, Object> parameters) {
    if (parameters == null) {
        parameters = Collections.emptyMap();
    }
    List<String> fragments = new ArrayList<String>(parameters.size());
    for (Map.Entry<String, Object> entry : parameters.entrySet()) {
        String key = entry.getKey();
        String value = entry.getValue() == null ? "" : entry.getValue().toString();
        fragments.add(encodeQueryComponent(key) + "=" + encodeQueryComponent(value));
    }
    return fragments.isEmpty() ? "" : "?" + StringUtils.join(fragments, "&");
}