T - the target type to be produced by this Mapper (the target class may
contain Jackson annotations for due mapping -- e.g.:
@JsonProperty, @JsonIgnore)public class JacksonYAMLToObjectMapper<T> extends JacksonJsonToObjectMapper<T> implements Mapper<T>
Mapper that loads the contents of a valid YAML Source
(e.g.: file, URL, string) into POJO (Plain Old Java Object), using Jackson's
YAMLMapper.
Additional details may be found at Jackson's official documentation.
Since version 2.4.0, this class supports lookup and registration of Jackson modules by
default. However, since modules lookup is considered a potentially expensive
operation, it can be disabled by setting the disableModules flag in the
constructor:
new JacksonYAMLToObjectMapper(Class<?>, boolean)
Note: To avoid a performance overhead, Jackson modules lookup happens
automatically at the first instantiation of a JacksonJsonToObjectMapper with
enable support for modules.
| Constructor and Description |
|---|
JacksonYAMLToObjectMapper(Class<T> targetType)
Builds a new YAML mapper with the specified target type and support for Jackson modules
enabled by default.
|
JacksonYAMLToObjectMapper(Class<T> targetType,
boolean disableModules)
Builds a new YAML mapper with the specified target type.
|
| Modifier and Type | Method and Description |
|---|---|
T |
apply(InputStream inputStream) |
configurationHelper, reloadModulesCache, resetModulesCacheequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconfigurationHelperpublic JacksonYAMLToObjectMapper(Class<T> targetType)
targetType - the target type to be produced by this Mapperpublic JacksonYAMLToObjectMapper(Class<T> targetType, boolean disableModules)
targetType - the target type to be produced by this MapperdisableModules - disable Jackson modules; useful for an optimized processing if
Jackson add-ons are NOT requiredpublic T apply(InputStream inputStream) throws IOException
apply in interface Mapper<T>apply in class JacksonJsonToObjectMapper<T>IOExceptionCopyright © 2023. All rights reserved.