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

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

package org.jtwig.json.configuration;

import org.jtwig.environment.Environment;
import org.jtwig.environment.EnvironmentConfigurationBuilder;
import org.jtwig.json.provider.CompositeJsonMapperProvider;
import org.jtwig.json.provider.JsonMapperProvider;

import java.util.Collection;

public class JsonMapperProviderConfiguration {
    private static final String JSON_MAPPER_PROVIDER = "jsonMapperProvider";

    public static JsonMapperProvider jsonMapperProvider (Environment environment) {
        return environment.parameter(JSON_MAPPER_PROVIDER);
    }

    private final Collection jsonMapperProviders;

    public JsonMapperProviderConfiguration(Collection jsonMapperProviders) {
        this.jsonMapperProviders = jsonMapperProviders;
    }

    public Collection getJsonMapperProviders() {
        return jsonMapperProviders;
    }

    public void configure(EnvironmentConfigurationBuilder environmentConfigurationBuilder) {
        environmentConfigurationBuilder.parameters().add(JSON_MAPPER_PROVIDER, new CompositeJsonMapperProvider(jsonMapperProviders));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy