List of usage examples for com.google.common.base Splitter on
@CheckReturnValue @GwtIncompatible("java.util.regex") public static Splitter on(final Pattern separatorPattern)
From source file:de.bund.bfr.knime.nls.BackwardUtils.java
public static List<String> stringToList(String s) { return Lists.newArrayList(Splitter.on(",").omitEmptyStrings().split(s)); }
From source file:com.google.caliper.runner.ProxyWorkerException.java
private static String formatMesssage(String stackTrace) { StringBuilder builder = new StringBuilder(stackTrace.length() + 512) .append("An exception occurred in a worker process. The stack trace is as follows:\n\t"); Joiner.on("\n\t").appendTo(builder, Splitter.on('\n').split(stackTrace)); return builder.toString(); }
From source file:eu.artist.reusevol.repo.common.util.CompositeRepoName.java
public static List<String> decomposeName(String inputPath, String splitChar) { return Splitter.on(splitChar).omitEmptyStrings().splitToList(inputPath); }
From source file:org.apache.jclouds.profitbricks.rest.domain.zonescoped.DataCenterAndId.java
public static DataCenterAndId fromSlashEncoded(String id) { Iterable<String> parts = Splitter.on('/').split(checkNotNull(id, "id")); checkArgument(Iterables.size(parts) == 2, "id must be in format dataCenterId/id"); return new DataCenterAndId(Iterables.get(parts, 0), Iterables.get(parts, 1)); }
From source file:com.googlecode.t7mp.configuration.Artifacts.java
public static AbstractArtifact fromCoordinates(String coordinates) { Iterable<String> splitted = Splitter.on(':').omitEmptyStrings().trimResults().split(coordinates); String[] strings = Iterables.toArray(splitted, String.class); if (strings.length < THREE || strings.length > FIVE) { throw new InvalidCoordinatesException(coordinates); } else {// ww w . j ava 2s . c om String extension = "jar"; //DEFAULT String classifier = null; //DEFAULT String groupId = strings[ZERO]; String artifactId = strings[ONE]; String version = strings[strings.length - ONE]; if (strings.length == FOUR) { extension = strings[TWO]; } if (strings.length == FIVE) { classifier = strings[THREE]; } return new DefaultArtifact(groupId, artifactId, version, classifier, extension); } }
From source file:org.raml.jaxrs.parser.source.Utilities.java
private static Path transformIntoPath(Class<?> clazz) { Splitter splitter = Splitter.on('.').omitEmptyStrings(); Iterable<String> subPackages = splitter.split(clazz.getPackage().getName()); Path current = Paths.get(""); for (String subPackage : subPackages) { current = current.resolve(subPackage); }/*from www . j a va 2s . co m*/ return current; }
From source file:org.jboss.hal.modelgraph.dmr.ResourceAddress.java
public static ResourceAddress of(String address) { if (!Strings.isNullOrEmpty(address) && !"/".equals(address)) { ModelNode node = new ModelNode(); String normalized = address.startsWith("/") ? address.substring(1) : address; Splitter.on('/').withKeyValueSeparator('=').split(normalized) .forEach((key, value) -> node.add().set(key, value)); return new ResourceAddress(node); }/*from w w w . j a v a 2 s . co m*/ return new ResourceAddress(); }
From source file:org.jclouds.azurecompute.arm.domain.RegionAndId.java
public static RegionAndId fromSlashEncoded(String id) { Iterable<String> parts = Splitter.on('/').split(checkNotNull(id, "id")); checkArgument(Iterables.size(parts) == 2, "id must be in format regionId/id"); return new AutoValue_RegionAndId(Iterables.get(parts, 0), Iterables.get(parts, 1)); }
From source file:org.gradle.performance.results.ResultsStoreHelper.java
public static List<String> splitVcsCommits(String string) { if (null != string) { return ImmutableList.copyOf(Splitter.on(",").split(string)); }/* w w w.j a va 2 s . c o m*/ return Collections.emptyList(); }
From source file:org.bitstrings.maven.plugins.portallocator.util.Helpers.java
public static Iterable<String> iterateOnSplit(String text, String separator, boolean omitEmpty) { final Splitter splitter = Splitter.on(separator).trimResults(); if (omitEmpty) { splitter.omitEmptyStrings();/* w w w .ja v a2 s . c om*/ } return splitter.split(text); }