当前位置: 首页>>代码示例>>Java>>正文


Java StringUtils.collectionToCommaDelimitedString方法代码示例

本文整理汇总了Java中org.springframework.util.StringUtils.collectionToCommaDelimitedString方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.collectionToCommaDelimitedString方法的具体用法?Java StringUtils.collectionToCommaDelimitedString怎么用?Java StringUtils.collectionToCommaDelimitedString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.util.StringUtils的用法示例。


在下文中一共展示了StringUtils.collectionToCommaDelimitedString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getType

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public Class<?> getType(String name) throws NoSuchBeanDefinitionException {
	String beanName = BeanFactoryUtils.transformedBeanName(name);

	Object bean = this.beans.get(beanName);
	if (bean == null) {
		throw new NoSuchBeanDefinitionException(beanName,
				"Defined beans are [" + StringUtils.collectionToCommaDelimitedString(this.beans.keySet()) + "]");
	}

	if (bean instanceof FactoryBean && !BeanFactoryUtils.isFactoryDereference(name)) {
		// If it's a FactoryBean, we want to look at what it creates, not the factory class.
		return ((FactoryBean<?>) bean).getObjectType();
	}
	return bean.getClass();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:StaticListableBeanFactory.java

示例2: asAuthorities

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
private String asAuthorities(Object object) {
	List<Object> authorities = new ArrayList<>();
	if (object instanceof Collection) {
		Collection<?> collection = (Collection<?>) object;
		object = collection.toArray(new Object[0]);
	}
	if (ObjectUtils.isArray(object)) {
		Object[] array = (Object[]) object;
		for (Object value : array) {
			if (value instanceof String) {
				authorities.add(value);
			}
			else if (value instanceof Map) {
				authorities.add(asAuthority((Map<?, ?>) value));
			}
			else {
				authorities.add(value);
			}
		}
		return StringUtils.collectionToCommaDelimitedString(authorities);
	}
	return object.toString();
}
 
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:24,代码来源:FixedAuthoritiesExtractor.java

示例3: getValue

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public Object getValue(QName name, ContentModelItemData<?> data)
{
    Serializable value = data.getPropertyValue(name);
    if (value != null && value instanceof List<?>)
    {
        List<?> list = (List<?>) value;
        if(!list.isEmpty() && list.get(0) instanceof String) 
        {
            List<String> escapedValues = new ArrayList<String>(list.size());
            for(Object listValue : list)
            {
               escapedValues.add(escape((String)listValue));
            }
            return StringUtils.collectionToCommaDelimitedString(escapedValues);
        }
    }
    return super.getValue(name, data);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:ExtendedPropertyFieldProcessor.java

示例4: getAccept

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Return the list of acceptable {@linkplain MediaType media types}, as specified by the {@code Accept} header.
 * <p>Returns an empty list when the acceptable media types are unspecified.
 * @return the acceptable media types
 */
public List<MediaType> getAccept() {
	String value = getFirst(ACCEPT);
	List<MediaType> result = (value != null ? MediaType.parseMediaTypes(value) : Collections.<MediaType>emptyList());

	// Some containers parse 'Accept' into multiple values
	if (result.size() == 1) {
		List<String> acceptHeader = get(ACCEPT);
		if (acceptHeader.size() > 1) {
			value = StringUtils.collectionToCommaDelimitedString(acceptHeader);
			result = MediaType.parseMediaTypes(value);
		}
	}

	return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:HttpHeaders.java

示例5: findByReleaseNameAndReleaseVersionRequired

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public AppDeployerData findByReleaseNameAndReleaseVersionRequired(String releaseName, Integer releaseVersion) {
	AppDeployerData appDeployerData = appDeployerDataRepository.findByReleaseNameAndReleaseVersion(releaseName,
			releaseVersion);
	if (appDeployerData == null) {
		List<AppDeployerData> appDeployerDataList = StreamSupport
				.stream(appDeployerDataRepository.findAll().spliterator(), false)
				.collect(Collectors.toList());
		String existingDeployerData = StringUtils.collectionToCommaDelimitedString(appDeployerDataList);
		throw new SkipperException(String.format("No AppDeployerData found for release '%s' version '%s'." +
				"AppDeployerData = %s",
				releaseName, releaseVersion, existingDeployerData));
	}
	return appDeployerData;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-skipper,代码行数:16,代码来源:AppDeployerDataRepositoryImpl.java

示例6: getBean

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public Object getBean(String name) throws BeansException {
	String beanName = BeanFactoryUtils.transformedBeanName(name);
	Object bean = this.beans.get(beanName);

	if (bean == null) {
		throw new NoSuchBeanDefinitionException(beanName,
				"Defined beans are [" + StringUtils.collectionToCommaDelimitedString(this.beans.keySet()) + "]");
	}

	// Don't let calling code try to dereference the
	// bean factory if the bean isn't a factory
	if (BeanFactoryUtils.isFactoryDereference(name) && !(bean instanceof FactoryBean)) {
		throw new BeanIsNotAFactoryException(beanName, bean.getClass());
	}

	if (bean instanceof FactoryBean && !BeanFactoryUtils.isFactoryDereference(name)) {
		try {
			return ((FactoryBean<?>) bean).getObject();
		}
		catch (Exception ex) {
			throw new BeanCreationException(beanName, "FactoryBean threw exception on object creation", ex);
		}
	}
	else {
		return bean;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:StaticListableBeanFactory.java

示例7: convertToEbeanOrderBy

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Convert spring data Sort to Ebean OrderBy.
 *
 * @param sort
 * @param <T>
 * @return
 */
public static <T> OrderBy<T> convertToEbeanOrderBy(Sort sort) {
  if (sort == null) {
    return null;
  }
  List<String> list = new ArrayList<>();
  while (sort.iterator().hasNext()) {
    Sort.Order so = sort.iterator().next();
    list.add(so.getDirection() == Sort.Direction.ASC ? so.getProperty() + " asc" : so.getProperty() + " desc");
  }
  return new OrderBy<T>(StringUtils.collectionToCommaDelimitedString(list));
}
 
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:19,代码来源:Converters.java

示例8: getAuthorities

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
    String userRoles = StringUtils.collectionToCommaDelimitedString(this.roles);
    return AuthorityUtils.commaSeparatedStringToAuthorityList(userRoles);
}
 
开发者ID:kplachkov,项目名称:KPBlog,代码行数:6,代码来源:BlogUserDetails.java

示例9: doHealthCheck

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
protected void doHealthCheck(Builder builder) throws Exception
{
    final MBeanServer server = getMBeanServer();

    if (server != null)
    {
        final ObjectName on = new ObjectName("Q2:type=qbean,service=*");
        final Set<ObjectName> names = server.queryNames(on, null);
        final Stream<ObjectName> s = names.stream();

        final long muxInTransitCount = getMuxInTransitCount(server, names);
        final long tmInTransitCount = getTmInTransitCount(server, names);

        builder.withDetail("mux.in-transit", String.valueOf(muxInTransitCount));
        builder.withDetail("tm.in-transit", String.valueOf(tmInTransitCount));
        builder.withDetail("in-transit", String.valueOf(Math.max(muxInTransitCount, tmInTransitCount)));

        if (s.allMatch(name -> getStatus(server, name) == QBean.STARTED))
        {
            builder.up();
        }
        else if (s.anyMatch(name -> getStatus(server, name) == QBean.FAILED))
        {
            long cnt = s.filter(name -> getStatus(server, name) == QBean.FAILED).count();

            Set<String> objs = s.filter(name -> getStatus(server, name) == QBean.FAILED)
                .map(ObjectName::getCanonicalName)
                .collect(Collectors.toSet());

            String failedServices = StringUtils.collectionToCommaDelimitedString(objs);
            builder.withDetail("failed-count", String.valueOf(cnt));
            builder.withDetail("failed-services", failedServices);
            builder.status("failed");
        }
        else if (s.allMatch(name -> getStatus(server, name) == QBean.DESTROYED))
        {
            builder.outOfService();
        }
        else if (s.allMatch(name -> getStatus(server, name) == QBean.STOPPED))
        {
            builder.down();
        }
        else
        {
            builder.unknown();
        }
    }
    else
    {
        builder.unknown();
    }
}
 
开发者ID:vmantek,项目名称:chimera,代码行数:54,代码来源:Q2DeploymentsHealthIndicator.java

示例10: getValue

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public Object getValue(QName name, ContentModelItemData<?> data)
{
    Serializable value = data.getPropertyValue(name);
    if (value == null)
    {
        return getDefaultValue(name, data);
    }
    
    if (value instanceof Collection<?>)
    {
        // temporarily add repeating field data as a comma
        // separated list, this will be changed to using
        // a separate field for each value once we have full
        // UI support in place.
        Collection<?> values = (Collection<?>) value;
        
        // if the non empty collection is a List of Date objects 
        // we need to convert each date to a ISO8601 format 
        if (value instanceof List<?> && !values.isEmpty())
        {
            List<?> list = (List<?>)values;
            if (list.get(0) instanceof Date)
            {
                List<String> isoDates = new ArrayList<String>(list.size());
                for (Object date : list)
                {
                    isoDates.add(ISO8601DateFormat.format((Date)date));
                }
                
                // return the ISO formatted dates as a comma delimited string 
                return StringUtils.collectionToCommaDelimitedString(isoDates);
            }
        }
        
        // return everything else using toString()
        return StringUtils.collectionToCommaDelimitedString(values);
    }
    else if (value instanceof ContentData)
    {
        // for content properties retrieve the info URL rather than the
        // the object value itself
        ContentData contentData = (ContentData)value;
        return contentData.getInfoUrl();
    }
    else if (value instanceof NodeRef)
    {
        return ((NodeRef)value).toString();
    }
    
    return value;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:53,代码来源:PropertyFieldProcessor.java

示例11: getAuthorities

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
    String roles = StringUtils.collectionToCommaDelimitedString(userRoles);
    return AuthorityUtils.commaSeparatedStringToAuthorityList(roles);
}
 
开发者ID:tadeucruz,项目名称:spring-oauth2-jwt,代码行数:6,代码来源:CustomUserDetails.java

示例12: getAuthorities

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {

    String roles = StringUtils.collectionToCommaDelimitedString(userRoles);
    return AuthorityUtils.commaSeparatedStringToAuthorityList(roles);
}
 
开发者ID:xSzymo,项目名称:Spring-web-shop-project,代码行数:7,代码来源:CustomUserDetails.java

示例13: NoUniqueBeanDefinitionException

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Create a new {@code NoUniqueBeanDefinitionException}.
 * @param type required type of the non-unique bean
 * @param beanNamesFound the names of all matching beans (as a Collection)
 */
public NoUniqueBeanDefinitionException(Class<?> type, Collection<String> beanNamesFound) {
	this(type, beanNamesFound.size(), "expected single matching bean but found " + beanNamesFound.size() + ": " +
			StringUtils.collectionToCommaDelimitedString(beanNamesFound));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:NoUniqueBeanDefinitionException.java

示例14: stringify

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Formats snapshot to cozy string.
 * @param metadata to get string for.
 * @return string representation.
 */
private String stringify(Metadata metadata) {
    return "Snapshot(timestamp=" + metadata.getTimestamp() + ", labels=" +
        StringUtils.collectionToCommaDelimitedString(commandService.metadataTree().getLabels(metadata)) + ")";
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:10,代码来源:CommandServiceCLIAware.java


注:本文中的org.springframework.util.StringUtils.collectionToCommaDelimitedString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。