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

org.simpleflatmapper.converter.DefaultContextFactoryBuilder Maven / Gradle / Ivy

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]));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy