List of usage examples for org.springframework.util Assert notEmpty
@Deprecated public static void notEmpty(@Nullable Map<?, ?> map)
From source file:com.github.lynxdb.server.core.TimeSerie.java
public static TimeSerie merge(List<TimeSerie> _series) { Assert.notEmpty(_series); List<SuperIterator> sil = new ArrayList<>(); _series.forEach((TimeSerie t) -> { if (t.hasNext()) { SuperIterator<Entry> si = new SuperIterator<>(t); si.next();//from ww w.java2 s . co m sil.add(si); } }); Map<String, String> tags = new HashMap<>(); tags.putAll(_series.get(0).getTags()); _series.forEach((TimeSerie t) -> { Iterator<Map.Entry<String, String>> i = tags.entrySet().iterator(); while (i.hasNext()) { Map.Entry<String, String> e = i.next(); if (!t.getTags().containsKey(e.getKey()) || !t.getTags().get(e.getKey()).equals(e.getValue())) { i.remove(); } } }); return new TimeSerie(_series.get(0).getName(), tags, new ChainableIterator<Entry>() { @Override public boolean hasNext() { return sil.stream() .anyMatch((superIterator) -> superIterator.hasNext() || superIterator.getCurrent() != null); } @Override public Entry next() { Iterator<SuperIterator> rr = sil.iterator(); while (rr.hasNext()) { if (rr.next().getCurrent() == null) { rr.remove(); } } long max = Long.MIN_VALUE; for (SuperIterator<Entry> r : sil) { max = Long.max(max, r.getCurrent().getTime()); } for (SuperIterator<Entry> r : sil) { if (r.getCurrent().getTime() == max) { r.next(); return r.getPrevious(); } } throw new IllegalStateException("something went wrong"); } }); }
From source file:net.projectmonkey.spring.acl.factory.DefaultAclAuthorizationStrategyFactoryBean.java
public DefaultAclAuthorizationStrategyFactoryBean(final String... authorisations) { Assert.notEmpty(authorisations); Assert.isTrue(authorisations.length == 1 || authorisations.length == 3, "Either 1 or 3 authorization strings must be provided"); this.authorisations = authorisations; }
From source file:com.azaptree.services.command.impl.CommandChainSupport.java
public CommandChainSupport(final String name, final Command... commands) { super(name);/*from w w w . j a v a2s.c om*/ Assert.notEmpty(commands); this.commands = commands; initChain(); }
From source file:com.nmote.xr.spring.XRSpringExporter.java
public void setServletContext(ServletContext servletContext) { Assert.notNull(servers);/*from www . ja v a 2 s . c o m*/ Assert.notEmpty(servers); // Save servlet context for destroy this.servletContext = servletContext; ObjectEndpoint endpoint = new ObjectEndpoint(); for (@SuppressWarnings("rawtypes") XRExportDef e : servers) { endpoint.prefix(e.getPrefix()); endpoint.faultMapper(e.getFaultMapper() != null ? e.getFaultMapper() : faultMapper); endpoint.typeConverter(typeConverter); endpoint.export(e.getServer(), e.getExport()); } // Export system.* methods if (exportMeta) { endpoint.prefix(null); endpoint.faultMapper(faultMapper); endpoint.exportMeta(); } servletContext.setAttribute(endpointKey, prepare(endpoint)); }
From source file:com.icfcc.cache.interceptor.CacheOperation.java
public void setCacheNames(String[] cacheNames) { Assert.notEmpty(cacheNames); this.cacheNames = new LinkedHashSet<String>(cacheNames.length); for (String string : cacheNames) { this.cacheNames.add(string); }//from ww w .j av a 2 s . co m }
From source file:com.denksoft.springstarter.util.security.CustomUserDetailsServiceWrapper.java
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException { Assert.notEmpty(userInfoObjectTypes); UserDetails userDetails = userDetailsService.loadUserByUsername(username); for (Class clazz : userInfoObjectTypes) { DetachedCriteria query = DetachedCriteria.forClass(clazz) .add(Restrictions.eq("user.username", username)); try {/*from www . ja v a 2 s . co m*/ Object info = getHibernateTemplate().findByCriteria(query).get(0); return new CustomUserDetailsWrapper(userDetails, roleHierarchy, info); } catch (IndexOutOfBoundsException ex) { //log Not necessary, for informational purpose only log.info("Did not find any " + clazz.getSimpleName() + " objects"); } } return new CustomUserDetailsWrapper(userDetails, roleHierarchy); }
From source file:com.google.code.guice.repository.configuration.RepositoriesGroupBuilder.java
public static RepositoriesGroupBuilder forPackages(Collection<String> repositoriesPackages) { Assert.notEmpty(repositoriesPackages); Assert.noNullElements(repositoriesPackages.toArray(new String[repositoriesPackages.size()])); return new RepositoriesGroupBuilder(repositoriesPackages); }
From source file:io.twipple.springframework.data.clusterpoint.core.support.RoundRobinLoadBalancingStrategy.java
@Override @NotNull//from w w w .j ava2 s. c o m public String getHostname(@NotNull List<String> hosts) { Assert.notEmpty(hosts); final int index = Math.abs(nextIndex.getAndIncrement() % hosts.size()); final String hostname = hosts.get(index); Assert.notNull(hostname); return hostname; }
From source file:com.kurento.kmf.jsonrpcconnector.internal.server.config.DefaultJsonRpcHandlerRegistration.java
@Override public JsonRpcHandlerRegistration addHandler(JsonRpcHandler<?> handler, String... paths) { Assert.notNull(handler);/*from w w w. j a va 2 s .c om*/ Assert.notEmpty(paths); this.handlerMap.put(handler, Arrays.asList(paths)); return this; }
From source file:org.oncoblocks.centromere.web.test.controller.RequestUtilTests.java
@Test public void requestUtilTest() throws Exception { Map<String, QueryParameterDescriptor> params = RequestUtils.getAvailableQueryParameters(CopyNumber.class); Assert.notNull(params);// w w w. ja v a 2 s . c om Assert.notEmpty(params); for (Map.Entry entry : params.entrySet()) { System.out.println(String.format("Param: %s, Type: %s", entry.getKey(), (entry.getValue()).toString())); } Assert.isTrue(params.containsKey("geneId")); Assert.isTrue(params.containsKey("gene.aliases")); Assert.isTrue(params.containsKey("gene")); Assert.isTrue(params.containsKey("signalOutside")); Assert.isTrue(params.get("signalOutside").getEvaluation().equals(Evaluation.OUTSIDE_INCLUSIVE)); }