Is It possible to add different Object type into ReflectedYamlDump?
See original GitHub issueI’m using a library that allows me to manage yaml and json files and in that case;
"test-scalar-type": "test-scalar-type"
"test-section":
"test-section-scalar-type": "test-scalar-type"
“test-section” is a ConfigurationSection
in my library and when I use dump() method. and It gives me StackOverFlow
because It must return Map or Scalar stuffs. And I resolve that problem with editing the ReflectYamlDump class like that;
@Override
public YamlNode dump() {
final YamlNode node;
if (this.object == null || ReflectedYamlDump.SCALAR_TYPES.contains(this.object.getClass())) {
node = new ReflectedYamlScalar(this.object);
} else if (this.object instanceof Collection || this.object.getClass().isArray()) {
node = new ReflectedYamlScalar(this.object);
} else if (this.object instanceof ConfigurationSection) {
node = new ReflectedYamlMapping(((ConfigurationSection) this.object).getValues(false));
} else {
node = new ReflectedYamlMapping(this.object);
}
return node;
}
It’s really temporary fix. And I want to know that how we can add a custom object into ReflectedYamlDump class without editing the library.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Dumping custom class objects to a YAML file - Stack Overflow
Dumping custom class objects to a YAML file ; # requisite imports here, based on # how the files are stored from ;...
Read more >A Powerful Python Trick: Custom YAML tags & PyYAML
A simple yet powerful way to improve the way you write and use configuration files in Python.
Read more >YAML: The Missing Battery in Python
Dumping Python Objects to YAML Documents. Choose the Dumper Class; Dump to a String, a File, or a Stream; Dump Multiple Documents ...
Read more >Dumping Python classes - ruamel.yaml - Read the Docs
User originates from the name of the class. You can specify a different tag by adding the attribute yaml_tag , and explicitly specify...
Read more >Yaml (SnakeYAML 1.19 API) - javadoc.io
Create Yaml instance. It is safe to create a few instances and use them in different Threads. Yaml. public Yaml(DumperOptions dumperOptions).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@portlek I think I understand now. It seems like an interesting feature, I’ll have a look 😃
ok then, closing this 😃