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

io.dropwizard.testing.POJOConfigurationFactory Maven / Gradle / Ivy

There is a newer version: 5.0.0-alpha.2
Show newest version
package io.dropwizard.testing;

import com.fasterxml.jackson.databind.JsonNode;
import io.dropwizard.configuration.ConfigurationSourceProvider;
import io.dropwizard.configuration.YamlConfigurationFactory;
import io.dropwizard.core.Configuration;
import io.dropwizard.jackson.Jackson;

import java.io.File;

public class POJOConfigurationFactory
    extends YamlConfigurationFactory {
    protected final C configuration;

    @SuppressWarnings("unchecked")
    public POJOConfigurationFactory(C cfg) {
        super((Class) cfg.getClass(), null, Jackson.newObjectMapper(), "dw");
        configuration = cfg;
    }

    @Override
    public C build(ConfigurationSourceProvider provider, String path) {
        return configuration;
    }

    @Override
    public C build(File file) {
        return configuration;
    }

    @Override
    public C build() {
        return configuration;
    }

    @Override
    protected C build(JsonNode node, String path) {
        return configuration;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy