Java Code Examples for org.springframework.util.StringUtils.commaDelimitedListToSet()

The following are Jave code examples for showing how to use commaDelimitedListToSet() of the org.springframework.util.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: spring-cloud-skipper   File: PackageReaderTests.java   View Source Code Vote up 5 votes
private Set<String> convertToSet(String tags) {
	Set<String> initialSet = StringUtils.commaDelimitedListToSet(tags);

	Set<String> setToReturn = initialSet.stream()
			.map(StringUtils::trimAllWhitespace)
			.collect(Collectors.toSet());

	return setToReturn;
}
 
Example 2
Project: cas-5.1.0   File: CouchbaseServiceRegistryConfiguration.java   View Source Code Vote up 5 votes
/**
 * Service registry couchbase client factory couchbase client factory.
 *
 * @return the couchbase client factory
 */
@RefreshScope
@Bean
public CouchbaseClientFactory serviceRegistryCouchbaseClientFactory() {
    final CouchbaseServiceRegistryProperties couchbase = casProperties.getServiceRegistry().getCouchbase();
    final Set<String> nodes = StringUtils.commaDelimitedListToSet(couchbase.getNodeSet());
    return new CouchbaseClientFactory(nodes, couchbase.getBucket(), couchbase.getPassword(), couchbase.getTimeout());
}
 
Example 3
Project: cas-5.1.0   File: CouchbaseTicketRegistryConfiguration.java   View Source Code Vote up 5 votes
@RefreshScope
@Bean
public CouchbaseClientFactory ticketRegistryCouchbaseClientFactory() {
    final CouchbaseTicketRegistryProperties cb = casProperties.getTicket().getRegistry().getCouchbase();
    final Set<String> nodes = StringUtils.commaDelimitedListToSet(cb.getNodeSet());
    return new CouchbaseClientFactory(nodes, cb.getBucket(), cb.getPassword(), cb.getTimeout());
}
 
Example 4
Project: spring-cloud-dataflow-metrics-collector   File: ApplicationMetricsService.java   View Source Code Vote up 5 votes
/**
 * Converts the plain model of {@link ApplicationMetrics} into a hierarchical
 * representation of {@link StreamMetrics}
 * @param filter Comma delimited list of stream names to be filtered on. If null or
 * empty all streams are returned
 * @return A collection of filtered {@link StreamMetrics}
 */
public Collection<StreamMetrics> toStreamMetrics(String filter) {
	Collection<StreamMetrics> entries = new LinkedList<>();
	Set<String> streamNames = null;
	try {
		this.rwLock.lock();
		if (StringUtils.isEmpty(filter)) {
			streamNames = storage.asMap().values().stream()
					.map(applicationMetrics -> String.valueOf(
							applicationMetrics.getFirst().getProperties().get(ApplicationMetrics.STREAM_NAME)))
					.collect(Collectors.toSet());
		}
		else {
			streamNames = StringUtils.commaDelimitedListToSet(filter);
		}

		for (String streamName : streamNames) {
			StreamMetrics streamMetrics = null;
			List<List<ApplicationMetrics>> filteredList = storage
					.asMap().values().stream().filter(applicationMetrics -> applicationMetrics.getFirst()
							.getProperties().get(ApplicationMetrics.STREAM_NAME).equals(streamName))
					.collect(Collectors.toList());
			for (List<ApplicationMetrics> applicationMetricsList : filteredList) {
				streamMetrics = convert(applicationMetricsList, streamMetrics);
			}
			if (streamMetrics != null) {
				entries.add(streamMetrics);
			}
		}
	}
	finally {
		this.rwLock.unlock();
	}
	return entries;
}