org.simpleflatmapper.converter.DefaultContextFactoryBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-converter Show documentation
Show all versions of sfm-converter Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.simpleflatmapper.converter;
import org.simpleflatmapper.util.Supplier;
import java.util.ArrayList;
public final class DefaultContextFactoryBuilder implements ContextFactoryBuilder {
private final ArrayList> suppliers = new ArrayList>();
public DefaultContextFactoryBuilder(){
}
@Override
public int addSupplier(Supplier> supplier) {
int index = suppliers.size();
suppliers.add(supplier);
return index;
}
@Override
public ContextFactory build() {
return suppliers.isEmpty() ? EmptyContextFactory.INSTANCE : new DefaultContextFactory(suppliers.toArray(new Supplier[0]));
}
}