In this post under Jackson YAML, I will show with example how to check whether a yaml parser feature is enabled or not. In previous post under Jackson YAML, I explained the purpose of yaml parser feature “YAMLParser.Feature.PARSE_BOOLEAN_LIKE_WORDS_AS_STRINGS”. For our example I will check whether the above parser feature is enabled or not. Below is…… Continue reading Checking whether yaml parser feature is enabled or not
Tag: YAML
Yaml parser feature PARSE_BOOLEAN_LIKE_WORDS_AS_STRINGS
In this post under Jackson Yaml, I will explain the purpose of parser feature “PARSE_BOOLEAN_LIKE_WORDS_AS_STRINGS” and how to enable or disable it. We all know that YAML parser, when parsing a file, if it encounters word “true” or “false” it treats them as boolean. In addition to that, synonyms of “true” and “false” like “yes”…… Continue reading Yaml parser feature PARSE_BOOLEAN_LIKE_WORDS_AS_STRINGS
Changing default configurations specific to YamlWriter
In this post under YamlBeans, I will explain with example how to change default configurations specific to YamlWriter. We take the help of YamlConfig.WriteConfig class. It is a inner static class. It has getters and setters that can be used to change default configurations specific to YamlWriter. For this example, we will use the below…… Continue reading Changing default configurations specific to YamlWriter
Changing default configurations specific to YamlReader
In this post under YamlBeans, I will explain with example how to change default configurations specific to YamlReader. We take the help of YamlConfig.ReadConfig class. It is a inner static class. It has getters and setters that can be used to change default configurations specific to YamlReader. For this example, we will use the below…… Continue reading Changing default configurations specific to YamlReader
Changing default configurations common to both YamlWriter and YamlReader
In this post under YamlBeans, I will explain with example how to change default configurations common to both YamlWriter and YamlReader. The YamlConfig class has getter and setters that can be used to change default configurations. For this example, we will use the below Employee1 class structure. Employee1 class import java.util.List; public class Employee1 {…… Continue reading Changing default configurations common to both YamlWriter and YamlReader
Deserializing YAML data to Java object
In this post under YamlBeans, I will show with an example of how to deserialize a YAML data to Java object. Main Code 1 import java.io.File; 2 import java.io.FileReader; 3 import java.io.IOException; 4 5 import com.esotericsoftware.yamlbeans.YamlReader; 6 7 public class YamlDemo2 { 8 public static void main(String[] args) { 9 File file = new File(“input1.yml”);…… Continue reading Deserializing YAML data to Java object
Serializing Java object to YAML format
In this post under YamlBeans, I will show with an example of how to serialize a Java object to YAML format. Below is the complete code Main Code 1 import java.io.File; 2 import java.io.FileWriter; 3 import java.io.IOException; 4 import java.util.ArrayList; 5 import java.util.List; 6 7 import com.esotericsoftware.yamlbeans.YamlWriter; 8 9 public class YamlDemo1 { 10 public…… Continue reading Serializing Java object to YAML format
UnMarshalling YAML file to Java Object
This post explains unmarshalling information stored in YAML format to java object . This can be achieved with the help of YAMLMapper provided by jackson package. To explain with an example we will use the below pojo objects Employee package package2; import java.math.BigDecimal; import java.util.List; public class Employee { private String id; private String name;…… Continue reading UnMarshalling YAML file to Java Object
Marshalling Java Object to YAML format
This post explains marshalling a java object to YAML format and storing it to a file. This can be achieved with the help of YAMLMapper provided by jackson package. To explain with an example we will use the below pojo objects. Employee package package2; import java.math.BigDecimal; import java.util.List; public class Employee { private String id;…… Continue reading Marshalling Java Object to YAML format
Creating a YAML file
The below post explains how to write YAML data to file using YAMLGenerator. YAMLGenerator writes the data to a file in streaming way, helping the developer using the api to avoid creating an object representation of the entire data. We can get an instance of YAMLGenerator with the help of an instance of YAMLFactory as…… Continue reading Creating a YAML file