Class YamlLoader
- java.lang.Object
-
- app.coronawarn.server.services.distribution.assembly.appconfig.YamlLoader
-
public class YamlLoader extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TloadYamlIntoClass(String path, Class<T> classType)Reads the class path resource yaml at given path and deserializes into an instance of the given object.static <T extends com.google.protobuf.Message.Builder>
TloadYamlIntoProtobufBuilder(String path, Class<T> builderType)Returns a protobufmessage builderof the specified type, whose fields have been set to the corresponding values from the yaml file at the specified path.
-
-
-
Method Detail
-
loadYamlIntoProtobufBuilder
public static <T extends com.google.protobuf.Message.Builder> T loadYamlIntoProtobufBuilder(String path, Class<T> builderType) throws UnableToLoadFileException
Returns a protobufmessage builderof the specified type, whose fields have been set to the corresponding values from the yaml file at the specified path.- Parameters:
path- The absolute path of the yaml file within the class path.builderType- The specificMessage.Builderimplementation that will be returned.- Returns:
- A prepared protobuf
message builderof the specified type. - Throws:
UnableToLoadFileException- if either the file access or subsequent yaml parsing fails.
-
loadYamlIntoClass
public static <T> T loadYamlIntoClass(String path, Class<T> classType) throws UnableToLoadFileException
Reads the class path resource yaml at given path and deserializes into an instance of the given object. The yaml naming convention is expected to be dash based ("an-example-property"), but the method will translate this to a camelCase class property.- Throws:
UnableToLoadFileException
-
-