com.fincatto.documentofiscal.nfe310.converters.NFStringNullToEmptyConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nfe Show documentation
Show all versions of nfe Show documentation
Biblioteca de comunicacao de nota fiscal eletronica brasileira
package com.fincatto.documentofiscal.nfe310.converters;
import org.apache.commons.lang3.StringUtils;
import org.simpleframework.xml.convert.Converter;
import org.simpleframework.xml.stream.InputNode;
import org.simpleframework.xml.stream.OutputNode;
public class NFStringNullToEmptyConverter implements Converter {
@Override
public String read(final InputNode node) throws Exception {
return StringUtils.defaultIfBlank(node.getValue(), StringUtils.EMPTY);
}
@Override
public void write(final OutputNode node, final String value) {
node.setValue(value);
}
}