當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。