use of org.yaml.snakeyaml.constructor.BaseConstructor in project spring-boot by spring-projects.
the class OriginTrackedYamlLoader method createYaml.
@Override
protected Yaml createYaml() {
BaseConstructor constructor = new OriginTrackingConstructor();
Representer representer = new Representer();
DumperOptions dumperOptions = new DumperOptions();
LimitedResolver resolver = new LimitedResolver();
return new Yaml(constructor, representer, dumperOptions, resolver);
}
use of org.yaml.snakeyaml.constructor.BaseConstructor in project camel by apache.
the class SnakeYAMLDataFormat method defaultConstructor.
// ***************************
// Defaults
// ***************************
private BaseConstructor defaultConstructor(CamelContext context) {
ClassLoader yamlClassLoader = this.classLoader;
Collection<TypeFilter> yamlTypeFilters = this.typeFilters;
if (yamlClassLoader == null && useApplicationContextClassLoader) {
yamlClassLoader = context.getApplicationContextClassLoader();
}
if (allowAnyType) {
yamlTypeFilters = Collections.singletonList(TypeFilters.allowAll());
}
BaseConstructor yamlConstructor;
if (yamlTypeFilters != null) {
yamlConstructor = yamlClassLoader != null ? typeFilterConstructor(yamlClassLoader, yamlTypeFilters) : typeFilterConstructor(yamlTypeFilters);
} else {
yamlConstructor = new SafeConstructor();
}
if (typeDescriptions != null && yamlConstructor instanceof Constructor) {
for (TypeDescription typeDescription : typeDescriptions) {
((Constructor) yamlConstructor).addTypeDescription(typeDescription);
}
}
return yamlConstructor;
}
Aggregations