Skip to content

Commit a05b4ab

Browse files
committed
More notes on AvroJavaTimeModule.
1 parent 707f3a4 commit a05b4ab

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

avro/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,18 @@ and that's about it, for now.
114114
## Java Time Support
115115
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`.
116116

117+
This module is to be used either:
118+
- Instead of Java 8 date/time module (`com.fasterxml.jackson.datatype.jsr310.JavaTimeModule`) or
119+
- to override Java 8 date/time module and for that, module must be registered AFTER Java 8 date/time module (last registration wins).
120+
117121
```java
118122
AvroMapper mapper = AvroMapper.builder()
119123
.addModule(new AvroJavaTimeModule())
120124
.build();
121125
```
122126

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

127131
#### Supported java.time types:

avro/src/main/java/com/fasterxml/jackson/dataformat/avro/jsr310/AvroJavaTimeModule.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020

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

0 commit comments

Comments
 (0)