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

org.jtwig.json.configuration.JsonMapperProviderConfigurationBuilder Maven / Gradle / Ivy

package org.jtwig.json.configuration;

import org.apache.commons.lang3.builder.Builder;
import org.jtwig.json.provider.JsonMapperProvider;

import java.util.ArrayList;
import java.util.Collection;

public class JsonMapperProviderConfigurationBuilder implements Builder {
    public static JsonMapperProviderConfigurationBuilder jsonConfiguration () {
        return new JsonMapperProviderConfigurationBuilder(new DefaultJsonMapperProviderConfiguration());
    }

    private final Collection providers = new ArrayList<>();

    public JsonMapperProviderConfigurationBuilder () {}
    public JsonMapperProviderConfigurationBuilder (JsonMapperProviderConfiguration prototype) {
        providers.addAll(prototype.getJsonMapperProviders());
    }

    public JsonMapperProviderConfigurationBuilder withJsonMapperProvider(JsonMapperProvider mapperProvider) {
        this.providers.add(mapperProvider);
        return this;
    }

    @Override
    public JsonMapperProviderConfiguration build() {
        return new JsonMapperProviderConfiguration(providers);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy