Skip to content

Commit fdd545a

Browse files
committed
Update README.md
1 parent 6ea3fe6 commit fdd545a

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
## Overview
22

3-
!YamlBeans makes it easy to serialize and deserialize Java object graphs to and from YAML, a human-friendly data format. Replace XML and properties files with YAML for more expressive power (lists, maps, anchors, etc) and easier hand-editing.
3+
YamlBeans makes it easy to serialize and deserialize Java object graphs to and from YAML, a human-friendly data format. Replace XML and properties files with YAML for more expressive power (lists, maps, anchors, etc) and easier hand-editing.
44

55
Maven Central:
66
http://repo1.maven.org/maven2/com/esotericsoftware/yamlbeans/yamlbeans/
77

88
## Basic deserialization
99

10-
The !YamlReader class is used to deserialize YAML to Java objects. The following YAML defines a Map with four entries. The "phone numbers" entry is a List of two items, each of which is a Map.
10+
The YamlReader class is used to deserialize YAML to Java objects. The following YAML defines a Map with four entries. The "phone numbers" entry is a List of two items, each of which is a Map.
1111

1212
```yaml
1313
name: Nathan Sweet
@@ -20,7 +20,7 @@ The !YamlReader class is used to deserialize YAML to Java objects. The following
2020
number: 425-555-2306
2121
```
2222
23-
The "read" method reads the next YAML document and deserializes it into !HashMaps, !ArrayLists, and Strings. Since we know the root object defined in the YAML of our example is a Map, we can cast the object and make use of it.
23+
The "read" method reads the next YAML document and deserializes it into HashMaps, ArrayLists, and Strings. Since we know the root object defined in the YAML of our example is a Map, we can cast the object and make use of it.
2424
2525
```java
2626
YamlReader reader = new YamlReader(new FileReader("contact.yml"));
@@ -32,7 +32,7 @@ The "read" method reads the next YAML document and deserializes it into !HashMap
3232

3333
## Multiple objects
3434

35-
A stream of YAML can contain more than one YAML document. Each call to !YamlReader#read() deserializes the next document into an object. YAML documents are delimited by "---" (this is optional for the first document).
35+
A stream of YAML can contain more than one YAML document. Each call to YamlReader#read() deserializes the next document into an object. YAML documents are delimited by "---" (this is optional for the first document).
3636

3737
```yaml
3838
name: Nathan Sweet
@@ -55,7 +55,7 @@ This prints the String "28" then "25":
5555

5656
## Deserializing other classes
5757

58-
There are two ways to deserialize something other than !HashMaps, !ArrayLists, and Strings. Imagine this YAML document and Java class:
58+
There are two ways to deserialize something other than HashMaps, ArrayLists, and Strings. Imagine this YAML document and Java class:
5959

6060
```yaml
6161
name: Nathan Sweet
@@ -68,17 +68,17 @@ There are two ways to deserialize something other than !HashMaps, !ArrayLists, a
6868
}
6969
```
7070

71-
The "read" method can be passed a class, so the !YamlReader knows what it is deserializing:
71+
The "read" method can be passed a class, so the YamlReader knows what it is deserializing:
7272

7373
```java
7474
YamlReader reader = new YamlReader(new FileReader("contact.yml"));
7575
Contact contact = reader.read(Contact.class);
7676
System.out.println(contact.age);
7777
```
7878

79-
The !YamlReader creates an instance of the Contact class and sets the "name" and "age" fields. The !YamlReader determines the "age" value in the YAML needs to be converted into a int. Deserialization would have failed if the age was not a valid int. The !YamlReader can set public fields and bean setter methods.
79+
The YamlReader creates an instance of the Contact class and sets the "name" and "age" fields. The YamlReader determines the "age" value in the YAML needs to be converted into a int. Deserialization would have failed if the age was not a valid int. The YamlReader can set public fields and bean setter methods.
8080

81-
Instead of telling the !YamlReader what type to deserialize, the type can alternatively be specified in the YAML using a tag:
81+
Instead of telling the YamlReader what type to deserialize, the type can alternatively be specified in the YAML using a tag:
8282

8383
```yaml
8484
!com.example.Contact
@@ -88,7 +88,7 @@ Instead of telling the !YamlReader what type to deserialize, the type can altern
8888
8989
## Serializing objects
9090
91-
The !YamlWriter class is used to serialize Java objects to YAML. The "write" method automatically handles this by recognizing public fields and bean getter methods.
91+
The YamlWriter class is used to serialize Java objects to YAML. The "write" method automatically handles this by recognizing public fields and bean getter methods.
9292
9393
```java
9494
Contact contact = new Contact();
@@ -107,7 +107,7 @@ This outputs:
107107
age: 28
108108
```
109109
110-
The tags are automatically output as needed so that the !YamlReader class will be able to reconstruct the object graph. For example, serializing this !ArrayList does not output any tag for the list because !YamlReader uses an !ArrayList by default.
110+
The tags are automatically output as needed so that the YamlReader class will be able to reconstruct the object graph. For example, serializing this ArrayList does not output any tag for the list because YamlReader uses an ArrayList by default.
111111
112112
```java
113113
List list = new ArrayList();
@@ -119,7 +119,7 @@ The tags are automatically output as needed so that the !YamlReader class will b
119119
- cow
120120
```
121121
122-
If the list was a !LinkedList, then !YamlWriter knows that a tag is needed and outputs:
122+
If the list was a LinkedList, then YamlWriter knows that a tag is needed and outputs:
123123
124124
```java
125125
List list = new LinkedList();
@@ -132,11 +132,11 @@ If the list was a !LinkedList, then !YamlWriter knows that a tag is needed and o
132132
- cow
133133
```
134134
135-
Note that it is not advisable to subclass Collection or Map. !YamlBeans will only serialize the collection or map and its elements, not any additional fields.
135+
Note that it is not advisable to subclass Collection or Map. YamlBeans will only serialize the collection or map and its elements, not any additional fields.
136136
137137
## Complex graphs
138138
139-
!YamlBeans can serialize any object graph.
139+
YamlBeans can serialize any object graph.
140140
141141
```java
142142
public class Contact {
@@ -200,7 +200,7 @@ The output no longer contains the full classname for the Contact class.
200200
201201
## Lists and maps
202202
203-
When reading or writing a List or Map, !YamlBeans cannot know what type of objects are supposed to be in the List or Map, so it will write out a tag.
203+
When reading or writing a List or Map, YamlBeans cannot know what type of objects are supposed to be in the List or Map, so it will write out a tag.
204204
205205
```yaml
206206
!com.example.Contact
@@ -223,7 +223,7 @@ This can make the YAML less readable. To improve this, you may define what eleme
223223
writer.close();
224224
```
225225

226-
Now !YamlBeans knows what to expect for elements of the "phoneNumbers" field, so extra tags will not be output.
226+
Now YamlBeans knows what to expect for elements of the "phoneNumbers" field, so extra tags will not be output.
227227

228228
```yaml
229229
!com.example.Contact
@@ -234,7 +234,7 @@ Now !YamlBeans knows what to expect for elements of the "phoneNumbers" field, so
234234
- number: 206-555-7654
235235
```
236236
237-
Setting the element type for a Map field tells !YamlBeans what to expect for values in the Map. Keys in a Map are always Strings.
237+
Setting the element type for a Map field tells YamlBeans what to expect for values in the Map. Keys in a Map are always Strings.
238238
239239
## Anchors
240240
@@ -248,7 +248,7 @@ When an object graph contains multiple references to the same object, an anchor
248248
best friend: *1
249249
```
250250
251-
In this map, the "oldest friend" and "best friend" keys reference the same object. The !YamlReader automatically handles the anchors in the YAML when rebuilding the object graph. By default, the !YamlWriter automatically outputs anchors when writing objects.
251+
In this map, the "oldest friend" and "best friend" keys reference the same object. The YamlReader automatically handles the anchors in the YAML when rebuilding the object graph. By default, the YamlWriter automatically outputs anchors when writing objects.
252252
253253
```java
254254
Contact contact = new Contact();
@@ -261,10 +261,10 @@ In this map, the "oldest friend" and "best friend" keys reference the same objec
261261

262262
## Architecture
263263

264-
The YAML tokenizer, parser, and emitter are based on those from the JvYAML project. They have been heavily refactored, bugs fixed, etc. The rest of the JvYAML project was not used because of its complexity. !YamlBeans strives for the simplest possible thing that works, with the goal being to make it easy to use the YAML data format with Java.
264+
The YAML tokenizer, parser, and emitter are based on those from the JvYAML project. They have been heavily refactored, bugs fixed, etc. The rest of the JvYAML project was not used because of its complexity. YamlBeans strives for the simplest possible thing that works, with the goal being to make it easy to use the YAML data format with Java.
265265

266-
!YamlBeans supports YAML version 1.0 and 1.1.
266+
YamlBeans supports YAML version 1.0 and 1.1.
267267

268268
## More info
269269

270-
See the javadocs for various other features available on the !YamlConfig class.
270+
See the javadocs for various other features available on the YamlConfig class.

0 commit comments

Comments
 (0)