From 4bf37340bc46bde1404c1c94436b60b46696ebd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9D=8F=E9=BB=91?= Date: Tue, 2 Apr 2019 22:20:41 +0800 Subject: [PATCH] + update TSerializer --- .../taboolib/common/serialize/TSerializable.java | 11 +++++++---- .../taboolib/common/serialize/TSerializerElement.java | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/scala/me/skymc/taboolib/common/serialize/TSerializable.java b/src/main/scala/me/skymc/taboolib/common/serialize/TSerializable.java index 2529adf..63a6fe1 100644 --- a/src/main/scala/me/skymc/taboolib/common/serialize/TSerializable.java +++ b/src/main/scala/me/skymc/taboolib/common/serialize/TSerializable.java @@ -6,12 +6,15 @@ package me.skymc.taboolib.common.serialize; */ public interface TSerializable { - void read(String fieldName, String value); + default void read(String fieldName, String value) { + } - String write(String fieldName, Object value); + default String write(String fieldName, Object value) { + return null; + } - default void read(String value) { - TSerializer.read(this, value); + default Object read(String value) { + return TSerializer.read(this, value); } default String write() { diff --git a/src/main/scala/me/skymc/taboolib/common/serialize/TSerializerElement.java b/src/main/scala/me/skymc/taboolib/common/serialize/TSerializerElement.java index 3232eab..e660389 100644 --- a/src/main/scala/me/skymc/taboolib/common/serialize/TSerializerElement.java +++ b/src/main/scala/me/skymc/taboolib/common/serialize/TSerializerElement.java @@ -8,7 +8,7 @@ public interface TSerializerElement { T read(String value); - String write(Object value); + String write(T value); boolean matches(Class objectClass);