io.dropwizard.testing.POJOConfigurationFactory Maven / Gradle / Ivy
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;
}
}