spreadsheet.mapper.w2o.process.setter.FieldSetterAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spreadsheet-mapper Show documentation
Show all versions of spreadsheet-mapper Show documentation
java mapping library between spreadsheet and object
The newest version!
package spreadsheet.mapper.w2o.process.setter;
import org.apache.commons.lang3.StringUtils;
import spreadsheet.mapper.model.core.Cell;
import spreadsheet.mapper.model.meta.FieldMeta;
/**
*
* field value setter adapter, easy implements customer value setter extends this.
* extends this will skip custom set when cell value is blank (default blank value means no need set ).
*
* Created by hanwen on 15-12-16.
*/
public abstract class FieldSetterAdapter> implements FieldSetter {
private String matchField;
public V matchField(String matchField) {
this.matchField = matchField;
return getThis();
}
@Override
public String getMatchField() {
return matchField;
}
@Override
public void set(T object, Cell cell, FieldMeta fieldMeta) {
if (StringUtils.isBlank(cell.getValue())) {
return;
}
customSet(object, cell, fieldMeta);
}
protected abstract V getThis();
protected abstract void customSet(T object, Cell cell, FieldMeta fieldMeta);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy