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


Java Converter.convert方法代码示例

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


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

示例1: blankConverter

import org.springframework.core.convert.converter.Converter; //导入方法依赖的package包/类
static <T> Converter<String, T> blankConverter(final Converter<String, T> converter) {
	return new Converter<String, T>() {
		@Override
		public T convert(String string) {
			return (StringUtils.hasText(string)) ? converter.convert(string) : null;
		}
	};
}
 
开发者ID:innodev-au,项目名称:wmboost-data,代码行数:9,代码来源:ConversionServiceUtils.java

示例2: addStringToMConverter

import org.springframework.core.convert.converter.Converter; //导入方法依赖的package包/类
private void addStringToMConverter(final Converter<S, M> scalarToTargetConverter) {
	Converter<String, M> numberToMConverter = 
			new Converter<String, M>() {
		@Override
		public M convert(String numberStr) {
			S intermediateValue = conversionService.convert(numberStr, scalarType);
			return scalarToTargetConverter.convert(intermediateValue);
			
		}
	};
		
	conversionService.addConverter(String.class, mutableType, ConversionServiceUtils.blankConverter(numberToMConverter));
}
 
开发者ID:innodev-au,项目名称:wmboost-data,代码行数:14,代码来源:NumberConverterGenerator.java

示例3: addNumberToMConverter

import org.springframework.core.convert.converter.Converter; //导入方法依赖的package包/类
private void addNumberToMConverter(final Converter<S, M> scalarToTargetConverter) {
				
		Converter<Number, M> numberToMConverter = 
			new Converter<Number, M>() {
			@Override
			public M convert(Number number) {
				S intermediateValue = conversionService.convert(number, scalarType);
				return scalarToTargetConverter.convert(intermediateValue);	
			}
		};
		
	conversionService.addConverter(Number.class, mutableType, numberToMConverter);		
}
 
开发者ID:innodev-au,项目名称:wmboost-data,代码行数:14,代码来源:NumberConverterGenerator.java

示例4: getActualLRPsByProcessGuid

import org.springframework.core.convert.converter.Converter; //导入方法依赖的package包/类
public <T> List<T> getActualLRPsByProcessGuid(String processGuid,
		Converter<ActualLRPResponse, T> converter) {
	List<ActualLRPResponse> responses = getResponses(processGuid);
	List<T> lrps = new ArrayList<>();
	for (ActualLRPResponse response : responses) {
		T converted = converter.convert(response);
		lrps.add(converted);
	}
	return lrps;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-lattice,代码行数:11,代码来源:ReceptorService.java

示例5: createAcl

import org.springframework.core.convert.converter.Converter; //导入方法依赖的package包/类
/**
 * @param principal
 *            Set the identifier of the principal
 * @param principalType
 *            Set the type of principal (group, user)
 * @param object
 *            Set the identifier of the object
 * @param objectType
 *            Set the class of object being secured
 * @param permission
 *            Set the permission
 */
public void createAcl(String principal,
		String principalType, String object,
		String objectType, String permission) {
	enableAuthentication();
	Taxon taxon = new Taxon();
	taxon.setIdentifier(object);
	org.springframework.security.acls.model.Permission perm = null;
	Converter<String, org.springframework.security.acls.model.Permission> converter = new StringToPermissionConverter();
	perm = converter.convert(permission);
	Class<? extends SecuredObject> clazz = null;
	if (objectType.equals("Source")) {
		clazz = Organisation.class;
	} else {
		clazz = Taxon.class;
	}
	if (principalType.equals("user")) {
		userService.addPermission(taxon, principal, perm, clazz);
	} else {
		groupService.addPermission(taxon, principal, perm, clazz);
	}

	AceDto ace = new AceDto();
	ace.setObject(object);
	ace.setPermission(perm);
	ace.setPrincipal(principal);
	ace.setClazz(clazz);

	data.push(ace);
	disableAuthentication();
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:43,代码来源:TestDataManager.java


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