org.octopusden.octopus.escrow.config.ComponentConfigParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of component-resolver-api Show documentation
Show all versions of component-resolver-api Show documentation
Octopus module: component-resolver-api
package org.octopusden.octopus.escrow.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.octopusden.releng.versions.VersionNames;
import java.io.IOException;
public class ComponentConfigParser {
private final VersionNames versionNames;
public ComponentConfigParser(VersionNames versionNames) {
this.versionNames = versionNames;
}
public ComponentConfig parse(String componentConfigJson) throws IOException {
ObjectMapper objectMapper = getObjectMapper();
return objectMapper.readValue(componentConfigJson, ComponentConfig.class);
}
private ObjectMapper getObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
SimpleModule module = new SimpleModule();
module.addDeserializer(ComponentConfig.class, new ComponentConfigDeserializer(versionNames));
objectMapper.registerModule(module);
return objectMapper;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy