List of usage examples for org.apache.commons.lang3 StringUtils join
public static String join(final Iterable<?> iterable, final String separator)
Joins the elements of the provided Iterable into a single String containing the provided elements.
No delimiter is added before or after the list.
From source file:de.micromata.genome.gwiki.controls.GWikiUserRightsPropsDescriptorValue.java
@SuppressWarnings("unchecked") @Override/*from ww w. j a va 2 s . c o m*/ public void parseRequest(PropsEditContext pct) { List<String> selrights = new ArrayList<String>(); Map<String, String[]> pm = pct.getWikiContext().getRequest().getParameterMap(); // String rv = pct.getRequestValue(); for (Map.Entry<String, String[]> me : pm.entrySet()) { if (me.getKey().startsWith("right.") == false) { continue; } selrights.add(me.getKey().substring("right.".length())); } String rl = StringUtils.join(selrights.toArray(), ","); pct.setPropsValue(rl); }
From source file:com.ppcxy.cyfm.showcase.demos.utilities.string.ApacheStringUtilsDemo.java
@Test public void joinSplit() { // join//from w w w . jav a 2s. c om List<String> inputList = Lists.newArrayList("a", "b", "c"); String result = StringUtils.join(inputList, ","); assertThat(result).isEqualTo("a,b,c"); // split String input = "a,b,c"; String[] resultArray = StringUtils.split(input, ","); assertThat(resultArray).containsSequence("a", "b", "c"); }
From source file:mesclasses.objects.LoadWindow.java
public LoadWindow(Stage stage, List<AppTask> tasks) { tasks.forEach(t -> {/*from w w w . j av a2 s . co m*/ services.add(new LoadingService(t)); }); dialogStage = new Stage(); dialogStage.setTitle("Chargement"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(stage); dialogStage.setScene(createloadingScene()); LOG.info("LOAD WINDOW REQUESTED. tasks = " + StringUtils.join(getTaskNames(), ",")); }
From source file:com.evolveum.midpoint.web.util.ExactMatchMountedMapper.java
/** * We want to fully match url path. Parent class is OK with partial match and then * marking other path element as page parameters. * * @param url// ww w .java 2 s.c o m * @return */ @Override protected boolean urlStartsWithMountedSegments(Url url) { if (url == null) { return false; } if (!(pageParametersEncoder instanceof PageParametersEncoder)) { LOG.trace("Matching using standard mounted mapper for '{}'", url); return super.urlStartsWithMountedSegments(url); } String mountUrl = StringUtils.join(mountSegments, "/"); boolean matched = url.getPath().equals(mountUrl); LOG.trace("Matched: {} for '{}' with mount url '{}'", matched, url, mountUrl); return matched; }
From source file:com.techcavern.wavetact.consoleCommands.config.Blacklist.java
@Override public void onCommand(String command, String[] args, CommandIO commandIO) { if (args.length > 0) { if (args[1].startsWith("-")) { Record blacklist = DatabaseUtils.getBlacklist(args[0], args[1].replaceFirst("\\-", "").replaceAll("http://|https://", "")); if (blacklist != null) { DatabaseUtils.removeBlacklist(args[0], args[1].replaceFirst("\\-", "").replaceAll("http://|https://", "")); commandIO.getPrintStream().println(args[0] + " blacklist removed"); } else { commandIO.getPrintStream().println(args[0] + " blacklist does not exist on list"); }/*from ww w. j a v a2 s . c o m*/ } else if (args[1].equalsIgnoreCase("list")) { Set<String> blacklists = new HashSet<>(); for (Record bl : DatabaseUtils.getBlacklists(args[0])) blacklists.add(bl.getValue(BLACKLISTS.URL)); if (!blacklists.isEmpty()) { commandIO.getPrintStream().println(StringUtils.join(blacklists, ", ")); } else { commandIO.getPrintStream().println(args[0] + " blacklist is empty"); } } else { Record blacklist = DatabaseUtils.getBlacklist(args[0], args[1].replaceFirst("\\-", "").replaceAll("http://|https://", "")); if (blacklist == null) { DatabaseUtils.addBlacklist(args[1].replaceFirst("\\-", "").replaceAll("http://|https://", ""), args[0]); commandIO.getPrintStream().println(args[0] + " blacklist added"); } else { commandIO.getPrintStream().println(args[0] + " blacklist is already listed"); } } } else { commandIO.getPrintStream().println("Please specify a " + args[0] + " blacklist"); } }
From source file:de.micromata.genome.logging.web.FormUrlEncodedBodyWriter.java
/** * Creates HTTP body form url encoded from the ParameterMap * @return the HTTP body form url encoded *//*from ww w. j ava 2 s . co m*/ public String createBody() { List<String> allParameters = parameterMap.entrySet().stream() .flatMap(e -> getParametersUrlEncoded(e.getKey(), e.getValue())).collect(Collectors.toList()); return StringUtils.join(allParameters, "&"); }
From source file:com.roche.iceboar.cachestorage.CacheStatus.java
@Override public String toString() { return StringUtils.join(statusSet, "\n"); }
From source file:de.blizzy.backup.LicenseDialog.java
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Text text = new Text(composite, SWT.BORDER | SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL); InputStream in = null;//from ww w . ja va2s. c o m try { in = BackupPlugin.getDefault().openBundleFile("etc/license.txt"); //$NON-NLS-1$ String licenseText = StringUtils.join(IOUtils.readLines(in, "ISO-8859-1"), '\n'); //$NON-NLS-1$ text.setText(licenseText); } catch (IOException e) { IOUtils.closeQuietly(in); } GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.widthHint = convertWidthInCharsToPixels(80); gd.heightHint = convertWidthInCharsToPixels(40); text.setLayoutData(gd); return composite; }
From source file:ductive.console.groovy.GroovyInterpreter.java
public Object interpret(String code) { String importSpec = StringUtils.join(imports, "\n"); String executeCode = importSpec + "true\n" + code; // i don't know why dummy 'true' is required... Script script = parse(executeCode, generateScriptName()); Binding ctx = getContext();// w w w . j ava 2s . c o m MetaClass clazz = ((GroovyObject) script).getMetaClass(); script.setBinding(ctx); Object result = script.evaluate(executeCode); for (MetaMethod m : clazz.getMethods()) { String name = m.getName(); if (!m.getDeclaringClass().getTheClass().equals(clazz.getTheClass())) continue; if (ArrayUtils.contains(ArrayUtils.toArray("main", "run"), name) || name.startsWith("super$") || name.startsWith("class$") || name.startsWith("$") || name.startsWith("__$")) continue; if (log.isTraceEnabled()) log.trace(String.format("defined function '%s'", m.getName())); ctx.setVariable(m.getName(), new MethodClosure(clazz.invokeConstructor(new Object[] {}), m.getName())); } if (StringUtils.trim(code).startsWith("import ")) registerImport(code); return result; }
From source file:$.Collections3.java
/** * ????(Getter), ??.//from w w w .j av a2 s.com * * @param collection ???. * @param propertyName ??????. * @param separator . */ public static String extractToString(final Collection collection, final String propertyName, final String separator) { List list = extractToList(collection, propertyName); return StringUtils.join(list, separator); }