本文整理了Java中org.springframework.batch.item.file.transform.FieldSet.getProperties()
方法的一些代码示例,展示了FieldSet.getProperties()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FieldSet.getProperties()
方法的具体详情如下:
包路径:org.springframework.batch.item.file.transform.FieldSet
类名称:FieldSet
方法名:getProperties
[英]Construct name-value pairs from the field names and string values. Null values are omitted.
[中]
代码示例来源:origin: spring-projects/spring-batch
/**
* Map the {@link FieldSet} to an object retrieved from the enclosing Spring
* context, or to a new instance of the required type if no prototype is
* available.
* @throws BindException if there is a type conversion or other error (if
* the {@link DataBinder} from {@link #createBinder(Object)} has errors
* after binding).
*
* @throws NotWritablePropertyException if the {@link FieldSet} contains a
* field that cannot be mapped to a bean property.
* @see org.springframework.batch.item.file.mapping.FieldSetMapper#mapFieldSet(FieldSet)
*/
@Override
public T mapFieldSet(FieldSet fs) throws BindException {
T copy = getBean();
DataBinder binder = createBinder(copy);
binder.bind(new MutablePropertyValues(getBeanProperties(copy, fs.getProperties())));
if (binder.getBindingResult().hasErrors()) {
throw new BindException(binder.getBindingResult());
}
return copy;
}
代码示例来源:origin: org.springframework.xd/spring-xd-batch
@Override
public SqlParameterSource createSqlParameterSource(FieldSet item) {
MapSqlParameterSource source = new MapSqlParameterSource();
Properties props = item.getProperties();
Set<String> keys = new HashSet<String>(props.stringPropertyNames());
for (String key : keys) {
source.addValue(key, props.get(key));
}
return source;
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Map the {@link FieldSet} to an object retrieved from the enclosing Spring
* context, or to a new instance of the required type if no prototype is
* available.
* @throws BindException if there is a type conversion or other error (if
* the {@link DataBinder} from {@link #createBinder(Object)} has errors
* after binding).
*
* @throws NotWritablePropertyException if the {@link FieldSet} contains a
* field that cannot be mapped to a bean property.
* @see org.springframework.batch.item.file.mapping.FieldSetMapper#mapFieldSet(FieldSet)
*/
@Override
public T mapFieldSet(FieldSet fs) throws BindException {
T copy = getBean();
DataBinder binder = createBinder(copy);
binder.bind(new MutablePropertyValues(getBeanProperties(copy, fs.getProperties())));
if (binder.getBindingResult().hasErrors()) {
throw new BindException(binder.getBindingResult());
}
return copy;
}
内容来源于网络,如有侵权,请联系作者删除!