Skip to content

Commit

Permalink
More notes on AvroJavaTimeModule.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalFoksa committed Jun 29, 2021
1 parent 707f3a4 commit a05b4ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion avro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,18 @@ and that's about it, for now.
## Java Time Support
Serialization and deserialization support for limited set of `java.time` classes to Avro with [logical type](http://avro.apache.org/docs/current/spec.html#Logical+Types) is provided by `AvroJavaTimeModule`.

This module is to be used either:
- Instead of Java 8 date/time module (`com.fasterxml.jackson.datatype.jsr310.JavaTimeModule`) or
- to override Java 8 date/time module and for that, module must be registered AFTER Java 8 date/time module (last registration wins).

```java
AvroMapper mapper = AvroMapper.builder()
.addModule(new AvroJavaTimeModule())
.build();
```

#### Note
Please note that time zone information is at serialization. Serialized values represent point in time,
Please note that time zone information is lost at serialization. Serialized values represent point in time,
independent of a particular time zone or calendar. Upon reading a value back time instant is reconstructed but not the original time zone.

#### Supported java.time types:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

/**
* A module that installs a collection of serializers and deserializers for java.time classes.
*
* This module is to be used either:
* - Instead of Java 8 date/time module (com.fasterxml.jackson.datatype.jsr310.JavaTimeModule) or
* - to override Java 8 date/time module and for that, module must be registered AFTER Java 8 date/time module.
*/
public class AvroJavaTimeModule extends SimpleModule {

Expand Down

0 comments on commit a05b4ab

Please sign in to comment.