Java 11 migration: patterns (t-v) (#1085)
* Moves visitor pattern to java 11 * Moves value-object pattern to java 11 * Moves unit-of-work pattern to java 11 * Moves typeobjectpattern pattern to java 11 * Moves twin pattern to java 11 * Moves trampoline pattern to java 11 * Moves tolerant-reader pattern to java 11 * Moves tls pattern to java 11 * Moves throttling pattern to java 11 * Moves thread-pool pattern to java 11 * Moves template-method pattern to java 11
This commit is contained in:
committed by
Ilkka Seppälä
parent
160b737dcc
commit
50467c9e76
@ -82,15 +82,18 @@ public final class RainbowFishSerializer {
|
||||
* Read V1 RainbowFish from file.
|
||||
*/
|
||||
public static RainbowFish readV1(String filename) throws IOException, ClassNotFoundException {
|
||||
Map<String, String> map = null;
|
||||
Map<String, String> map;
|
||||
|
||||
try (var fileIn = new FileInputStream(filename);
|
||||
var objIn = new ObjectInputStream(fileIn)) {
|
||||
map = (Map<String, String>) objIn.readObject();
|
||||
}
|
||||
|
||||
return new RainbowFish(map.get("name"), Integer.parseInt(map.get("age")), Integer
|
||||
.parseInt(map.get("lengthMeters")),
|
||||
Integer.parseInt(map.get("weightTons")));
|
||||
return new RainbowFish(
|
||||
map.get("name"),
|
||||
Integer.parseInt(map.get("age")),
|
||||
Integer.parseInt(map.get("lengthMeters")),
|
||||
Integer.parseInt(map.get("weightTons"))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user