All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.redis.riot.file.MapFieldSetMapper Maven / Gradle / Ivy

The newest version!
package com.redis.riot.file;

import java.util.HashMap;
import java.util.Map;

import org.springframework.batch.item.file.mapping.FieldSetMapper;
import org.springframework.batch.item.file.transform.FieldSet;
import org.springframework.util.StringUtils;

public class MapFieldSetMapper implements FieldSetMapper> {

	@Override
	public Map mapFieldSet(FieldSet fieldSet) {
		Map fields = new HashMap<>();
		String[] names = fieldSet.getNames();
		for (int index = 0; index < names.length; index++) {
			String value = fieldSet.readString(index);
			if (StringUtils.hasLength(value)) {
				fields.put(names[index], value);
			}
		}
		return fields;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy