List of usage examples for org.springframework.util Assert notEmpty
public static void notEmpty(@Nullable Map<?, ?> map, Supplier<String> messageSupplier)
From source file:ee.kovmen.xtee.consumer.CustomWebServiceAccessor.java
/** * Creates a connection to the given URI, or throws an exception when it cannot be resolved. * <p/>/*from w w w .ja v a 2s . c o m*/ * Default implementation iterates over all configured {@link WebServiceMessageSender} objects, and calls {@link * WebServiceMessageSender#supports(URI)} for each of them. If the sender supports the parameter URI, it creates a * connection using {@link WebServiceMessageSender#createConnection(URI)} . * * @param uri the URI to open a connection to * @return the created connection * @throws IllegalArgumentException when the uri cannot be resolved * @throws IOException when an I/O error occurs */ protected WebServiceConnection createConnection(URI uri) throws IOException { Assert.notEmpty(getMessageSenders(), "Property 'messageSenders' is required"); WebServiceMessageSender[] messageSenders = getMessageSenders(); for (int i = 0; i < messageSenders.length; i++) { if (messageSenders[i].supports(uri)) { WebServiceConnection connection = messageSenders[i].createConnection(uri); /*if (logger.isDebugEnabled()) { try { logger.debug("Opening [" + connection + "] to [" + connection.getUri() + "]"); } catch (URISyntaxException e) { // ignore } }*/ return connection; } } throw new IllegalArgumentException("Could not resolve [" + uri + "] to a WebServiceMessageSender"); }
From source file:cz.jirutka.spring.unboundid.InMemoryDirectoryServerFactoryBean.java
/** * @param baseDNs The set of base DNs to use for the server. *//*from w w w . ja v a 2s . c o m*/ public void setBaseDNs(List<String> baseDNs) { Assert.notEmpty(baseDNs, "At least one base DN must be provided"); this.baseDNs = baseDNs; }
From source file:org.mytms.common.dao.querydsl.QSort.java
/** * Returns a new {@link QSort} consisting of the {@link OrderSpecifier}s of the current {@link QSort} combined with * the given ones.//from ww w . jav a 2s .c o m * * @param orderSpecifiers must not be {@literal null} or empty. * @return */ public QSort and(List<OrderSpecifier<?>> orderSpecifiers) { Assert.notEmpty(orderSpecifiers, "OrderSpecifiers must not be null or empty!"); List<OrderSpecifier<?>> newOrderSpecifiers = new ArrayList<>(this.orderSpecifiers); newOrderSpecifiers.addAll(orderSpecifiers); return new QSort(newOrderSpecifiers); }
From source file:net.javacrumbs.springws.test.validator.SchemaRequestValidator.java
/** * Sets the schema resources to use for validation. Setting this property, {@link * #setXsdSchemaCollection(XsdSchemaCollection) xsdSchemaCollection}, {@link #setSchema(Resource) schema}, or {@link * #setSchemas(Resource[]) schemas} is required. *//* ww w . jav a 2 s.co m*/ public void setSchemas(Resource[] schemas) { Assert.notEmpty(schemas, "schemas must not be empty or null"); for (int i = 0; i < schemas.length; i++) { Assert.notNull(schemas[i], "schema must not be null"); Assert.isTrue(schemas[i].exists(), "schema \"" + schemas[i] + "\" does not exit"); } this.schemas = schemas; }
From source file:com.creactiviti.piper.core.git.JGitTemplate.java
private IdentifiableResource readBlob(Repository aRepo, String aPath, String aBlobId) throws Exception { try (ObjectReader reader = aRepo.newObjectReader()) { if (aBlobId.equals(LATEST)) { List<IdentifiableResource> headFiles = getHeadFiles(aRepo, aPath); Assert.notEmpty(headFiles, "could not find: " + aPath + ":" + aBlobId); return headFiles.get(0); }/*ww w . j a v a 2s.co m*/ ObjectId objectId = aRepo.resolve(aBlobId); Assert.notNull(objectId, "could not find: " + aPath + ":" + aBlobId); byte[] data = reader.open(objectId).getBytes(); AbbreviatedObjectId abbreviated = reader.abbreviate(objectId); return new IdentifiableResource(aPath + ":" + abbreviated.name(), new ByteArrayResource(data)); } }
From source file:com.civilizer.web.handler.ResourceHttpRequestHandler.java
/** * Set a {@code List} of {@code Resource} paths to use as sources * for serving static resources./*from w w w. j a va2s .co m*/ */ public void setLocations(List<Resource> locations) { Assert.notEmpty(locations, "Locations list must not be empty"); this.locations = locations; }
From source file:com.azaptree.services.command.impl.CommandServiceImpl.java
@PostConstruct public void init() { Assert.notEmpty(catalogs, "No catalogs were found"); final Map<String, CommandCatalog> catMap = new HashMap<>(); final Map<CommandKey, Command> cmdMap = new HashMap<>(); for (final CommandCatalog catalog : catalogs) { log.info("registering catalog : {}", catalog.getName()); if (catMap.get(catalog.getName()) != null) { throw new IllegalArgumentException("Duplicate Catalog name found: " + catalog.getName()); }/*from w w w.j a v a 2 s. com*/ catMap.put(catalog.getName(), catalog); for (final String commandName : catalog.getCommandNames()) { final Command command = catalog.getCommand(commandName); Assert.notNull(command); final CommandKey commandKey = new CommandKey(catalog.getName(), commandName); cmdMap.put(commandKey, command); log.info("registered CommandKey: {}", commandKey); } } catalogs = null; // no longer needed commandCatalogs = ImmutableMap.<String, CommandCatalog>builder().putAll(catMap).build(); commands = ImmutableMap.<CommandKey, Command>builder().putAll(cmdMap).build(); }
From source file:org.mytms.common.dao.querydsl.QSort.java
/** * Returns a new {@link QSort} consisting of the {@link OrderSpecifier}s of the current {@link QSort} combined with * the given ones./* w w w . j a v a2 s .c o m*/ * * @param orderSpecifiers must not be {@literal null} or empty. * @return */ public QSort and(OrderSpecifier<?>... orderSpecifiers) { Assert.notEmpty(orderSpecifiers, "OrderSpecifiers must not be null or empty!"); return and(Arrays.asList(orderSpecifiers)); }
From source file:us.swcraft.springframework.session.store.aerospike.AerospikeTemplate.java
@Override public void persist(final String key, final Set<Bin> bins) { Assert.notNull(key, "key can't be null"); final Key recordKey = new Key(namespace, setname, key); Assert.notNull(bins, "bins can't be null"); Assert.notEmpty(bins, "bins should have data to store"); getAerospikeClient().put(writePolicy, recordKey, bins.toArray(BIN_ARRAY_TYPE)); }
From source file:org.codehaus.groovy.grails.plugins.springsecurity.acl.ProxyAwareDelegatingMethodSecurityMetadataSource.java
/** * {@inheritDoc}//from ww w .j a v a 2 s .co m * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() */ public void afterPropertiesSet() { Assert.notEmpty(_methodSecurityMetadataSources, "A list of MethodSecurityMetadataSources is required"); }