I am using SnakeYaml to parse yaml file, is there anyway to ignore properities from the yaml file ?
YAML files can be parsed in a Java application using the SnakeYAML library. It is a simple, lightweight library providing high-level serialization and deserialization APIs for YAML files. To store several documents at once, use the load() or loadAll() functions in batches.
SnakeYAML allows you to read a YAML file into a simple Map object or parse the file and convert it into a custom Java object. Depending on your requirements you can decide in which format you want to read your YAML files.
Since the implementation is not thread safe, different threads must have their own Yaml instance.
I found it :)
Representer representer = new Representer();
representer.getPropertyUtils().setSkipMissingProperties(true);
Yaml yaml = new Yaml(new Constructor(MyClass.class),representer);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With