Skip to content

Commit

Permalink
doc: document enum deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-grgt committed Mar 4, 2024
1 parent d497011 commit 268fb1f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ Xjx exists out of two modules:
# 🔑 Key Features
- Explicitly map fields to specific tags using `@Tag`
- Select specific tags using an **XPath** like expression `@Tag(path = "/WeatherData/Location/City)`
- Out-of-the-box support for most common data types
- Out-of-the-box support for most common data types (including enums, collections, and maps)
- Explicit deserialization of values using `@ValueDeserialization`
- Support for records

# ✨ xjx-serdes

Expand Down Expand Up @@ -169,6 +170,14 @@ public class Person {
}
```
### Enum types
Xjx offers straightforward and efficient deserialization support for Enum types.
When mapping XML character data to Enum fields in Java, Xjx matches the character data with the names of the Enum constants.
Deserialization Rules for Enums
- Direct Name Matching: The deserializer matches the XML character data directly with the names of the Enum constants. The match is case-sensitive.
- Defaulting to Null: If the XML character data does not match any Enum constant names, the field is set to null. This is the default behavior when a match cannot be established.
### Collection types
When deserializing an XML document containing repeated elements, it can be mapped onto one of the collection types `List` or `Set`.
Expand Down

0 comments on commit 268fb1f

Please sign in to comment.