package org.simpleflatmapper.csv.impl.cellreader;
import org.simpleflatmapper.csv.CellValueReader;
import org.simpleflatmapper.csv.mapper.BreakDetector;
import org.simpleflatmapper.csv.mapper.CsvMapperCellConsumer;
import org.simpleflatmapper.csv.mapper.DelayedCellSetter;
import org.simpleflatmapper.csv.mapper.DelayedCellSetterFactory;
import org.simpleflatmapper.reflect.Setter;
public class DelayedCellSetterFactoryImpl<T, P> implements DelayedCellSetterFactory<T, P> {
private final CellValueReader<? extends P> reader;
private final Setter<? super T, ? super P> setter;
public DelayedCellSetterFactoryImpl(CellValueReader<? extends P> reader, Setter<? super T, ? super P> setter) {
this.reader = reader;
this.setter = setter;
}
@Override
public DelayedCellSetter<T, P> newCellSetter(BreakDetector breakDetector, CsvMapperCellConsumer<?>[] cellHandlers) {
return new DelayedCellSetterImpl<T, P>(setter, reader);
}
@Override
public boolean hasSetter() {
return setter != null;
}
@Override
public String toString() {
return "DelayedCellSetterFactoryImpl{" +
"reader=" + reader +
", setter=" + setter +
'}';
}
}