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:de.tudarmstadt.ukp.dkpro.core.io.brat.internal.model.BratAttributeDecl.java
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(name);/* ww w .j av a 2 s. com*/ sb.append('\t'); sb.append("Arg:"); sb.append(StringUtils.join(targetTypes, "|")); if (!values.isEmpty()) { sb.append(", Value:"); sb.append(StringUtils.join(values, "|")); } return sb.toString(); }
From source file:com.haulmont.cuba.core.jmx.PasswordEncryptionSupport.java
@Override public String getSupportedHashMethods() { Map<String, EncryptionModule> encryptionModules = AppBeans.getAll(EncryptionModule.class); Set<String> methods = new HashSet<>(); for (EncryptionModule module : encryptionModules.values()) { methods.add(module.getHashMethod()); }//from w ww .jav a 2 s .co m return StringUtils.join(methods, ", "); }
From source file:edu.scripps.fl.pubchem.promiscuity.OverallListsAndMapsFactory.java
public List<Long> aidListEsearch(List<Long> ids, String searchTerm, String db) throws Exception { List<Long> newAids = new ArrayList<Long>(); EUtilsFactory factory = new EUtilsFactory(); StringBuffer query = new StringBuffer(); query.append("(" + StringUtils.join(ids, "[" + db + "IdTested] OR ")); query.append("[" + db + "IdTested]) AND " + searchTerm); newAids = factory.getIds(query.toString(), "pcassay"); return newAids; }
From source file:com.flexive.shared.search.DateFunction.java
/** * Return the date function for the given FxSQL name (e.g. "year"). * * @param sqlName the FxSQL function name * @return the date function/* www. j a va2 s. co m*/ * @throws com.flexive.shared.exceptions.FxRuntimeException if the given SQL name is not a date function */ public static DateFunction getBySqlName(String sqlName) { for (DateFunction function : DateFunction.values()) { if (function.getSqlName().equalsIgnoreCase(sqlName)) { return function; } } throw new FxNotFoundException("ex.sqlSearch.function.date", sqlName, StringUtils.join(FxSQLFunctions.getSqlNames(Arrays.asList(DateFunction.values())), ", ")) .asRuntimeException(); }
From source file:de.tudarmstadt.ukp.dkpro.core.tokit.TokenFilterTest.java
@Test public void testProcess() throws Exception { AnalysisEngine filter = createPrimitive(TokenFilter.class, TokenFilter.PARAM_MAX_TOKEN_LENGTH, 5); String content = "1 22 333 4444 55555 666666 7777777 88888888 999999999"; JCas jcas = filter.newJCas();//from ww w. java 2 s . com TokenBuilder<Token, Annotation> tb = new TokenBuilder<Token, Annotation>(Token.class, Annotation.class); tb.buildTokens(jcas, content); filter.process(jcas); assertEquals("1 22 333 4444 55555", StringUtils.join(toText(select(jcas, Token.class)), " ")); }
From source file:com.evolveum.midpoint.cli.ninja.command.ObjectTypeConverter.java
private StringBuilder createMessage(Object value) { StringBuilder sb = new StringBuilder(); sb.append("Unknown value '").append(value).append("', possible values are: "); List<String> values = new ArrayList<>(); for (ObjectType type : ObjectType.values()) { values.add(type.getParameterName()); }/*from www .j a v a2 s. c o m*/ sb.append(StringUtils.join(values, ", ")); sb.append('.'); return sb; }
From source file:io.github.apfelcreme.MbPets.Commands.HelpCommand.java
/** * executes the command//from ww w .j a v a 2s.c o m * * @param chatInput the input */ public void execute(ChatInput chatInput) { if (!chatInput.getSender().hasPermission("MbPets.print")) { chatInput.getSender().sendMessage(MbPetsConfig.getTextNode("error.noPermission")); return; } if (chatInput.getType() == null) { // user only entered /pet help chatInput.getSender().sendMessage(MbPetsConfig.getTextNode("help.Options")); chatInput.getSender() .sendMessage(MbPetsConfig.getTextNode("info.types") + ChatColor.GREEN + StringUtils.join(MbPetsConfig.getAvailableTypes(), ", ") + ChatColor.GREEN + ", " + StringUtils.join(MbPetsConfig.getAvailableDroppedItems(), ", ") + ChatColor.GREEN + ", " + StringUtils.join(MbPetsConfig.getAvailableFallingBlocks(), ", ")); return; } chatInput.getSender().sendMessage(MbPetsConfig.getTextNode("help.Head")); DisguiseType type = MbPetsConfig.parseType(chatInput.getType()) != null ? MbPetsConfig.parseType(chatInput.getType()) : DisguiseType.DROPPED_ITEM; switch (type) { case CHICKEN: chatInput.getSender().sendMessage( MbPetsConfig.getTextNode("info.Element").replace("{0}", ChatColor.DARK_GREEN + "Baby") .replace("{1}", MbPetsConfig.getTextNode("help.BABY"))); break; case COW: chatInput.getSender().sendMessage( MbPetsConfig.getTextNode("info.Element").replace("{0}", ChatColor.DARK_GREEN + "Baby") .replace("{1}", MbPetsConfig.getTextNode("help.BABY"))); break; case DROPPED_ITEM: chatInput.getSender() .sendMessage(MbPetsConfig.getTextNode("info.Element") .replace("{0}", ChatColor.DARK_GREEN + "Typ") .replace("{1}", StringUtils.join(MbPetsConfig.getAvailableDroppedItems(), ", "))); break; case HORSE: chatInput.getSender().sendMessage( MbPetsConfig.getTextNode("info.Element").replace("{0}", ChatColor.DARK_GREEN + "Baby") .replace("{1}", MbPetsConfig.getTextNode("help.BABY"))); chatInput.getSender() .sendMessage(MbPetsConfig.getTextNode("info.Element") .replace("{0}", ChatColor.DARK_GREEN + "Color") .replace("{1}", StringUtils.join(MbPetsConfig.getAvailableHorseColors(), ", "))); chatInput.getSender() .sendMessage(MbPetsConfig.getTextNode("info.Element") .replace("{0}", ChatColor.DARK_GREEN + "Style") .replace("{1}", StringUtils.join(MbPetsConfig.getAvailableHorseStyles(), ", "))); break; case MUSHROOM_COW: chatInput.getSender().sendMessage( MbPetsConfig.getTextNode("info.Element").replace("{0}", ChatColor.DARK_GREEN + "Baby") .replace("{1}", MbPetsConfig.getTextNode("help.BABY"))); break; case OCELOT: chatInput.getSender().sendMessage( MbPetsConfig.getTextNode("info.Element").replace("{0}", ChatColor.DARK_GREEN + "Baby") .replace("{1}", MbPetsConfig.getTextNode("help.BABY"))); chatInput.getSender() .sendMessage(MbPetsConfig.getTextNode("info.Element") .replace("{0}", ChatColor.DARK_GREEN + "Style") .replace("{1}", StringUtils.join(MbPetsConfig.getAvailableOcelotStyles(), ", "))); break; case PIG: chatInput.getSender().sendMessage( MbPetsConfig.getTextNode("info.Element").replace("{0}", ChatColor.DARK_GREEN + "Baby") .replace("{1}", MbPetsConfig.getTextNode("help.BABY"))); break; case RABBIT: chatInput.getSender().sendMessage( MbPetsConfig.getTextNode("info.Element").replace("{0}", ChatColor.DARK_GREEN + "Baby") .replace("{1}", MbPetsConfig.getTextNode("help.BABY"))); chatInput.getSender() .sendMessage(MbPetsConfig.getTextNode("info.Element") .replace("{0}", ChatColor.DARK_GREEN + "Style") .replace("{1}", StringUtils.join(MbPetsConfig.getAvailableRabbitStyles(), ", "))); break; case SHEEP: chatInput.getSender().sendMessage( MbPetsConfig.getTextNode("info.Element").replace("{0}", ChatColor.DARK_GREEN + "Baby") .replace("{1}", MbPetsConfig.getTextNode("help.BABY"))); chatInput.getSender().sendMessage( MbPetsConfig.getTextNode("info.Element").replace("{0}", ChatColor.DARK_GREEN + "Color") .replace("{1}", StringUtils.join(MbPetsConfig.getAvailableColors(), ", "))); break; case SKELETON_HORSE: chatInput.getSender().sendMessage( MbPetsConfig.getTextNode("info.Element").replace("{0}", ChatColor.DARK_GREEN + "Baby") .replace("{1}", MbPetsConfig.getTextNode("help.BABY"))); break; case UNDEAD_HORSE: chatInput.getSender().sendMessage( MbPetsConfig.getTextNode("info.Element").replace("{0}", ChatColor.DARK_GREEN + "Baby") .replace("{1}", MbPetsConfig.getTextNode("help.BABY"))); break; case WOLF: chatInput.getSender().sendMessage( MbPetsConfig.getTextNode("info.Element").replace("{0}", ChatColor.DARK_GREEN + "Baby") .replace("{1}", MbPetsConfig.getTextNode("help.BABY"))); chatInput.getSender().sendMessage( MbPetsConfig.getTextNode("info.Element").replace("{0}", ChatColor.DARK_GREEN + "Color") .replace("{1}", StringUtils.join(MbPetsConfig.getAvailableColors(), ", "))); break; default: chatInput.getSender().sendMessage(ChatColor.DARK_GREEN + "keine"); return; } chatInput.getSender() .sendMessage(MbPetsConfig.getTextNode("info.Element").replace("{0}", ChatColor.DARK_GREEN + "Name") .replace("{1}", MbPetsConfig.getTextNode("help.NAME"))); }
From source file:com.pureinfo.ark.lifecycle.LifecyleHelper.java
/** * Handles lifecycle event for Ark content. * /* w w w .j a va2s.c o m*/ * @param _nType * event type * @param _source * event source * @return the total number of listeners who have handled this event. * @throws PureException * if failed to find the listeners or to handle the event. */ public static int handleEvent(int _nType, ArkContent _source) throws PureException { ContentType contentType = ArkContentHelper.lookupTypeByClass(_source.getClass().getName()); LifecycleEvent event = new LifecycleEvent(_nType, _source); int nTotalHandled = 0; //1. to check if the content is cached if (contentType.isCached()) { ContentCacheServer.handleEvent(event); nTotalHandled++; } //2. to notify other listeners String[] arrListenerIds = contentType.getListenerIds(); if (arrListenerIds == null || arrListenerIds.length == 0) { return nTotalHandled; } //else try { ILifecycleListener listener; for (int i = 0; i < arrListenerIds.length; i++) { listener = (ILifecycleListener) PureFactory.getBean(arrListenerIds[i]); if (listener.handleEvent(event)) { nTotalHandled++; } } if (logger.isDebugEnabled()) { logger.debug(nTotalHandled + " listeners have handled the event: " + event.toString()); } return nTotalHandled; } catch (Exception ex) { logger.error("event " + event.toString() + "; listeners=" + StringUtils.join(arrListenerIds, ","), ex); throw new PureException(ArkExceptionTypes.LIFECYCLE_EVENT_HANDLE, event.toString(), ex); } }
From source file:de.softwareforge.pgpsigner.commands.SignEventCommand.java
@Override public void executeInteractiveCommand(final String[] args) { getContext().setSignEvent(StringUtils.join(ArrayUtils.subarray(args, 1, args.length), ' ')); }
From source file:eionet.cr.dto.DeliveryFilterDTO.java
/** * Returns displayable label of the filter. * * @return/*from ww w.j av a 2s . co m*/ */ public String getLabel() { List<String> list = new ArrayList<String>(); if (StringUtils.isNotEmpty(obligationLabel)) { list.add(obligationLabel); } if (StringUtils.isNotEmpty(localityLabel)) { list.add(localityLabel); } if (StringUtils.isNotEmpty(year)) { list.add(year); } return StringUtils.join(list, ", "); }