public class YamlLoader extends Object
This loader uses Jackson's YAML plugin to do the actual parsing of data. As such, this class follows Jackson's own recommendations regarding thread-safeness; that is that instances of this class are fully thread-safe provided that ALL configuration of the internal ObjectMapper occurs before any loading/deserialization takes place.
YAML documents containing an \@import field as an array of file paths will recursively import the YAML documents found at those paths giving precedence to the YAML document doing the import.
| Constructor and Description |
|---|
YamlLoader() |
| Modifier and Type | Method and Description |
|---|---|
com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper()
Returns the ObjectMapper used to load/deserialize YAML files.
|
<T> T |
load(Class<T> targetType,
Path... paths)
Deserializes the YAML data contained in the provided files into the provided Jackson POJO.
|
<T> T |
load(Class<T> targetType,
Reader... readers)
Deserializes the YAML data contained in the provided readers into the provided Jackson POJO.
|
com.fasterxml.jackson.databind.JsonNode |
load(Path... paths)
Deserializes the YAML data contained in the provided files into a single JsonNode.
|
com.fasterxml.jackson.databind.JsonNode |
load(Reader... readers)
Deserializes the YAML data contained in the provided readers into a single JsonNode.
|
public com.fasterxml.jackson.databind.JsonNode load(Reader... readers) throws com.fasterxml.jackson.core.JsonProcessingException, IOException
readers - the readers containing the raw YAML datacom.fasterxml.jackson.core.JsonProcessingException - if a failure occurs while parsing the JSON dataIOException - if one or more of the readers failspublic <T> T load(Class<T> targetType, Reader... readers) throws com.fasterxml.jackson.core.JsonProcessingException, IOException
readers - the readers containing the raw YAML datacom.fasterxml.jackson.core.JsonProcessingException - if a failure occurs while parsing the JSON data or while boxing the resultIOException - if one or more of the readers failspublic com.fasterxml.jackson.databind.JsonNode load(Path... paths) throws com.fasterxml.jackson.core.JsonProcessingException, IOException
paths - the files containing the raw YAML datacom.fasterxml.jackson.core.JsonProcessingException - if a failure occurs while parsing the JSON dataIOException - if a failure occurs while reading data from one or more of the filespublic <T> T load(Class<T> targetType, Path... paths) throws com.fasterxml.jackson.core.JsonProcessingException, IOException
paths - the files containing the raw YAML datacom.fasterxml.jackson.core.JsonProcessingException - if a failure occurs while parsing the JSON data or while boxing the resultIOException - if a failure occurs while reading data from one or more of the filespublic com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
Copyright © 2017. All rights reserved.