mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-19 03:26:07 +00:00
docs: update tolerant reader
This commit is contained in:
@@ -28,7 +28,7 @@ import java.io.IOException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Tolerant Reader is an integration pattern that helps creating robust communication systems. The
|
||||
* Tolerant Reader is an integration pattern that helps to create robust communication systems. The
|
||||
* idea is to be as tolerant as possible when reading data from another service. This way, when the
|
||||
* communication schema changes, the readers must not break.
|
||||
*
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package com.iluwatar.tolerantreader;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -35,6 +36,7 @@ import lombok.RequiredArgsConstructor;
|
||||
@RequiredArgsConstructor
|
||||
public class RainbowFish implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final String name;
|
||||
|
||||
+2
-3
@@ -30,6 +30,7 @@ import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.Map;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* RainbowFishSerializer provides methods for reading and writing {@link RainbowFish} objects to
|
||||
@@ -37,14 +38,12 @@ import java.util.Map;
|
||||
* RainbowFish} objects. This way the reader does not break even though new properties are added to
|
||||
* the schema.
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
public final class RainbowFishSerializer {
|
||||
|
||||
public static final String LENGTH_METERS = "lengthMeters";
|
||||
public static final String WEIGHT_TONS = "weightTons";
|
||||
|
||||
private RainbowFishSerializer() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Write V1 RainbowFish to file.
|
||||
*/
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package com.iluwatar.tolerantreader;
|
||||
|
||||
import java.io.Serial;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
@@ -32,6 +33,7 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public class RainbowFishV2 extends RainbowFish {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private boolean sleeping;
|
||||
|
||||
Reference in New Issue
Block a user