List of usage examples for java.util Collection toArray
Object[] toArray();
From source file:ar.com.zauber.commons.message.impl.message.ResourceBundleMessageTemplate.java
/** * @see MessageFactory#renderString(java.lang.String, java.util.Map) * //w w w. j a v a 2s . c om * Try not to use this one. * * */ @SuppressWarnings("unchecked") public final String renderString(final String message, final Map<String, Object> model) { List<Map.Entry<String, Object>> entries = new ArrayList<Map.Entry<String, Object>>(model.entrySet()); Collections.sort(entries, new Comparator<Map.Entry<String, Object>>() { public int compare(final Map.Entry<String, Object> o1, final Map.Entry<String, Object> o2) { return o1.getKey().compareTo(o2.getKey()); } }); Collection<Object> parameters = CollectionUtils.collect(entries, new BeanToPropertyValueTransformer("value")); return renderString(message, parameters.toArray()); }
From source file:de.hybris.platform.yb2bacceleratorfacades.search.converters.populator.DefaultB2BFlexibleSearchPopulator.java
protected SearchStateData getSearchStateData(final Collection<String> skus) { final SearchQueryData searchQueryData = new SearchQueryData(); searchQueryData.setValue(//w ww. j av a2 s. c o m StringUtils.join(skus.toArray(), Config.getParameter(ADVANCED_SEARCH_PRODUCT_IDS_DELIMITER))); final SearchStateData searchStateData = new SearchStateData(); searchStateData.setQuery(searchQueryData); return searchStateData; }
From source file:com.tutu.flume.ExtendableSinkCounter.java
public ExtendableSinkCounter(String name, Collection<String> args) { super(MonitoredCounterGroup.Type.SINK, name, (String[]) ArrayUtils.addAll(ATTRIBUTES, args.toArray())); }
From source file:com.frank.search.solr.SolrRealtimeGetRequest.java
public SolrRealtimeGetRequest(Collection<? extends Serializable> ids) { super(METHOD.GET, "/get"); Assert.notEmpty(ids, "At least one 'id' is required for real time get request."); Assert.noNullElements(ids.toArray(), "Real time get request can't be made for 'null' id."); toStringIds(ids);/*w w w. ja v a2 s . c o m*/ }
From source file:it.cnr.isti.labse.glimpse.rules.DroolsRulesManager.java
public void getLoadedRulesInfo() { DebugMessages.line();//from w w w. jav a 2 s .co m Collection<KnowledgePackage> pkg = kbuilder.getKnowledgePackages(); Object[] pkgArray = pkg.toArray(); KnowledgePackage pkgPd = (org.drools.definition.KnowledgePackage) pkgArray[0]; Collection<Rule> loadedRules = pkgPd.getRules(); Object[] rlsArray = loadedRules.toArray(); Rule rl; for (int i = 0; i < rlsArray.length; i++) { rl = (Rule) rlsArray[i]; System.err.println("Package: " + pkgPd.getName() + " - RuleName: " + rl.getName()); } DebugMessages.line(); }
From source file:it.cnr.isti.labse.glimpse.rules.DroolsRulesManager.java
@Override void deleteRule(final String ruleName) throws UnknownRuleException { final Collection<KnowledgePackage> pkg = kbase.getKnowledgePackages(); final Object[] pkgArray = pkg.toArray(); final KnowledgePackage pkgPd = (org.drools.definition.KnowledgePackage) pkgArray[0]; kbase.removeRule(pkgPd.getName(), ruleName); DebugMessages.line();/*w w w .j a v a 2 s . c o m*/ DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(), "Rule " + ruleName + " successfully deleted"); DebugMessages.line(); }
From source file:org.simbasecurity.core.domain.repository.PolicyDatabaseRepositoryTest.java
@Test public void canFindPoliciesById() throws Exception { Collection<Policy> result = policyDatabaseRepository .findAllByIds(Arrays.asList(policy1.getId(), policy3.getId())); assertArrayEquals(Arrays.asList(policy1, policy3).toArray(), result.toArray()); }
From source file:org.seamless_ip.services.dao.test.EnumDaoTest.java
@SuppressWarnings("unchecked") @Test// ww w .j av a2s . co m public void dimensionEnumTest() { Collection<EnumTO> enums = enumerations.findAll(Dimension.class.getName()); assertEquals(4, enums.size()); assertEquals("environmental", ((EnumTO) enums.toArray()[0]).getLabel()); assertEquals("economic", ((EnumTO) enums.toArray()[1]).getLabel()); assertEquals("social", ((EnumTO) enums.toArray()[2]).getLabel()); assertEquals("multifunctionality", ((EnumTO) enums.toArray()[3]).getLabel()); }
From source file:es.gva.cit.gazetteer.adl.protocols.ADLThesaurus.java
/** * It implements the getNarrower ADL thesaurus operation * /*from w ww .j a va 2s . co m*/ */ private void getNarrower() { URL urlNarrower; try { urlNarrower = new URL("http", getUrl().getHost(), getUrl().getPort(), getUrl().getFile() + "/get-narrower"); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); return; } Collection nodes = new HTTPGetProtocol().doQuery(urlNarrower, getNarrowerParams(), 0); parseGetNarrowAnswer((XMLNode) nodes.toArray()[0]); }
From source file:org.seamless_ip.services.dao.test.EnumDaoTest.java
@SuppressWarnings("unchecked") @Test//from w w w . j av a 2 s. c o m public void genericThemeEnumTest() { Collection<EnumTO> enums = enumerations.findAll(GenericTheme.class.getName()); assertEquals(3, enums.size()); assertEquals("ultimate goal", ((EnumTO) enums.toArray()[0]).getLabel()); assertEquals("processes for achievement", ((EnumTO) enums.toArray()[1]).getLabel()); assertEquals("means", ((EnumTO) enums.toArray()[2]).getLabel()); // printEnums(enums); }