List of usage examples for org.apache.commons.lang StringUtils join
public static String join(Collection<?> collection, String separator)
Joins the elements of the provided Collection
into a single String containing the provided elements.
From source file:com.mmj.app.lucene.analyzer.AbstractWordAnalyzer.java
@Override public String segWords(String input, String wordSpilt, SegMode segMode) { List<String> segWords = segWords(input, segMode); return StringUtils.join(segWords, wordSpilt); }
From source file:net.pickapack.fsm.event.EnterStateEvent.java
@Override public String toString() { return String.format("After %s: %s.%s%s", getFsm(), getSender(), getCondition(), (getParams() == null || getParams().isEmpty() ? "" : "(" + StringUtils.join(Arrays.asList(getParams()), ", ") + ")")); }
From source file:com.ms.commons.test.integration.apachexmlparse.internal.LocalResourceLoader.java
public Resource getResource(String location) { System.out.println("Get resource: " + location); try {/*from w ww . j ava2 s . c o m*/ boolean isFromCache = true; String dtdFileName = IntlTestGlobalConstants.TESTCASE_DTD_DIR + File.separator + StringUtil.replaceNoWordChars(location) + ".dtd"; if (DTD_MAP.get(dtdFileName) == null) { File dtdFile = new File(dtdFileName); if (!dtdFile.exists()) { // load dtd from net isFromCache = false; String dtdContent = StringUtils.join( IOUtils.readLines((new URL(location)).openStream(), "UTF-8"), IntlTestGlobalConstants.LINE_SEPARATOR); FileUtils.writeStringToFile(dtdFile, dtdContent, "UTF-8"); DTD_MAP.put(dtdFileName, dtdContent); } else { DTD_MAP.put(dtdFileName, FileUtils.readFileToString(dtdFile, "UTF-8")); } } if (isFromCache) { System.out.println("Get resource from cache: " + location); } else { System.out.println("Get resource from net: " + location); } return new ByteArrayResource(DTD_MAP.get(dtdFileName).getBytes("UTF-8")); } catch (Exception e) { return parent.getResource(location); } }
From source file:edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AutocompleteObjectPropertyFormGenerator.java
@Override public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { HashMap<String, Object> formSpecificData = new HashMap<String, Object>(); //Get the edit mode formSpecificData.put("editMode", getEditMode(vreq).toString().toLowerCase()); //We also need the type of the object itself formSpecificData.put("objectTypes", StringUtils.join(getTypes(vreq), ",")); //Get label for individual if it exists if (EditConfigurationUtils.getObjectIndividual(vreq) != null) { String objectLabel = EditConfigurationUtils.getObjectIndividual(vreq).getName(); formSpecificData.put("objectLabel", objectLabel); }/* w w w . ja v a 2s.c o m*/ formSpecificData.put("sparqlForAcFilter", getSparqlForAcFilter(vreq)); editConfiguration.setTemplate(objectPropertyTemplate); editConfiguration.setFormSpecificData(formSpecificData); }
From source file:net.pickapack.fsm.event.ExitStateEvent.java
@Override public String toString() { return String.format("Before %s: %s.%s%s", getFsm(), getSender(), getCondition(), (getParams() == null || getParams().isEmpty() ? "" : "(" + StringUtils.join(Arrays.asList(getParams()), ", ") + ")")); }
From source file:com.xsw.utils.Collections3.java
/** * ????(Getter), ??.//from w w w . j ava 2s .c o m * * @param collection ???. * @param propertyName ??????. * @param separator . */ @SuppressWarnings("all") public static String extractToString(final Collection collection, final String propertyName, final String separator) { List list = extractToList(collection, propertyName); return StringUtils.join(list, separator); }
From source file:com.enonic.cms.server.service.servlet.CmsDispatcherServlet.java
@Override protected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setHeader("Allow", StringUtils.join(ALLOWED_HTTP_METHODS, ",")); response.setStatus(HttpServletResponse.SC_OK); }
From source file:com.titankingdoms.dev.titanchat.command.defaults.BlacklistCommand.java
@Override public void execute(CommandSender sender, Channel channel, String[] args) { if (args[0].equals("list")) { String list = StringUtils.join(channel.getBlacklist(), ", "); sendMessage(sender, "&6" + channel.getName() + " Blacklist: " + list); return;//from w ww . j a va 2 s. c om } else { if (args.length < 2) { sendMessage(sender, "&4Invalid argument length"); sendMessage(sender, "&6/titanchat [@<channel>] blacklist " + getUsage()); return; } } Participant participant = plugin.getParticipantManager().getParticipant(args[1]); if (args[0].equalsIgnoreCase("add")) { if (channel.getBlacklist().contains(participant.getName())) { sendMessage(sender, participant.getDisplayName() + " &4is already on the blacklist"); return; } channel.unlink(participant); channel.getBlacklist().add(participant.getName()); participant.notice("&4You have been added to the blacklist of " + channel.getName()); if (args.length > 2) { String reason = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ").trim(); participant.notice("&4Reason: " + reason); } if (!channel.isLinked(plugin.getParticipantManager().getParticipant(sender))) sendMessage(sender, participant.getDisplayName() + " &6has been added to the blacklist"); channel.notice(participant.getDisplayName() + " &6has been added to the blacklist"); } else if (args[0].equalsIgnoreCase("remove")) { if (!channel.getBlacklist().contains(participant.getName())) { sendMessage(sender, participant.getDisplayName() + " &4is not on the blacklist"); return; } channel.getBlacklist().remove(participant.getName()); participant.notice("&6You have been removed from the blacklist of " + channel.getName()); if (args.length > 2) { String reason = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ").trim(); participant.notice("&6Reason: " + reason); } if (!channel.isLinked(plugin.getParticipantManager().getParticipant(sender))) sendMessage(sender, participant.getDisplayName() + " &6has been removed from the blacklist"); channel.notice(participant.getDisplayName() + " &6has been removed from the blacklist"); } else { sendMessage(sender, "&4Incorrect usage: /titanchat [@<channel>] blacklist " + getUsage()); } }
From source file:de.l3s.archivepig.get.Host.java
@Override public String exec(Tuple data, Object... params) throws ExecException { String surtUrl = get(data, "url"); String[] parts = surtUrl.split("\\)"); String[] segments = parts[0].split("\\,"); String[] host = new String[segments.length]; for (int i = 0; i < segments.length; i++) { host[host.length - 1 - i] = segments[i]; }/*from w ww . ja v a 2 s.c o m*/ return StringUtils.join(host, "."); }
From source file:com.alibaba.cobar.manager.util.CobarStringUtil.java
public static String mergeListedStringWithJoin(String[] input, String sep) { List<String> rst = mergeListedString(input); return StringUtils.join(rst, ","); }