本文整理汇总了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;
}
};
}
示例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));
}
示例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);
}
示例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;
}
示例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();
}