From 50c21ca8d302ba45bb5ba973bc325e5088e554bd Mon Sep 17 00:00:00 2001 From: tursom Date: Tue, 11 Aug 2020 01:02:10 +0800 Subject: [PATCH] add TypeAdapter --- .../main/kotlin/cn/tursom/database/TypeAdapterFactory.kt | 6 ++++++ .../kotlin/cn/tursom/database/typeadapter/BooleanAdapter.kt | 2 ++ .../kotlin/cn/tursom/database/typeadapter/BytesAdapter.kt | 2 ++ .../kotlin/cn/tursom/database/typeadapter/DateAdapter.kt | 2 ++ .../kotlin/cn/tursom/database/typeadapter/DoubleAdapter.kt | 2 ++ .../kotlin/cn/tursom/database/typeadapter/EnumAdapter.kt | 2 ++ .../kotlin/cn/tursom/database/typeadapter/FloatAdapter.kt | 2 ++ .../kotlin/cn/tursom/database/typeadapter/InstantAdapter.kt | 2 ++ .../kotlin/cn/tursom/database/typeadapter/IntAdapter.kt | 2 ++ .../cn/tursom/database/typeadapter/IntAdapterAdapter.kt | 2 ++ .../kotlin/cn/tursom/database/typeadapter/JsonAdapter.kt | 2 ++ .../cn/tursom/database/typeadapter/LocalDateAdapter.kt | 2 ++ .../cn/tursom/database/typeadapter/LocalDateTimeAdapter.kt | 2 ++ .../cn/tursom/database/typeadapter/LocalTimeAdapter.kt | 2 ++ .../kotlin/cn/tursom/database/typeadapter/LongAdapter.kt | 2 ++ .../cn/tursom/database/typeadapter/MonthDayAdapter.kt | 2 ++ .../kotlin/cn/tursom/database/typeadapter/StringAdapter.kt | 2 ++ .../kotlin/cn/tursom/database/typeadapter/TimeAdapter.kt | 2 ++ .../cn/tursom/database/typeadapter/TimestampAdapter.kt | 2 ++ .../kotlin/cn/tursom/database/typeadapter/UUIDAdapter.kt | 2 ++ .../kotlin/cn/tursom/database/typeadapter/YearAdapter.kt | 2 ++ .../cn/tursom/database/typeadapter/YearMonthAdapter.kt | 2 ++ 22 files changed, 48 insertions(+) diff --git a/database/src/main/kotlin/cn/tursom/database/TypeAdapterFactory.kt b/database/src/main/kotlin/cn/tursom/database/TypeAdapterFactory.kt index 96383e0..7b155e0 100644 --- a/database/src/main/kotlin/cn/tursom/database/TypeAdapterFactory.kt +++ b/database/src/main/kotlin/cn/tursom/database/TypeAdapterFactory.kt @@ -64,4 +64,10 @@ object TypeAdapterFactory { } return null } + + override fun toString() = adapterMap.toString() +} + +fun main() { + println(TypeAdapterFactory) } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/BooleanAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/BooleanAdapter.kt index a456477..944f19a 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/BooleanAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/BooleanAdapter.kt @@ -15,4 +15,6 @@ object BooleanAdapter : TypeAdapter { null } } + + override fun toString() = "BooleanAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/BytesAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/BytesAdapter.kt index f3c72ba..40b0583 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/BytesAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/BytesAdapter.kt @@ -15,4 +15,6 @@ object BytesAdapter : TypeAdapter { null } } + + override fun toString() = "BytesAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/DateAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/DateAdapter.kt index bb79e05..5b15816 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/DateAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/DateAdapter.kt @@ -16,4 +16,6 @@ object DateAdapter : TypeAdapter { null } } + + override fun toString() = "DateAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/DoubleAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/DoubleAdapter.kt index 1427365..3e4c39c 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/DoubleAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/DoubleAdapter.kt @@ -15,4 +15,6 @@ object DoubleAdapter : TypeAdapter { null } } + + override fun toString() = "DoubleAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/EnumAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/EnumAdapter.kt index 0abdf57..d837c93 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/EnumAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/EnumAdapter.kt @@ -22,4 +22,6 @@ object EnumAdapter : TypeAdapter { } } + override fun toString() = "EnumAdapter" + } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/FloatAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/FloatAdapter.kt index b0a01f3..6c69b41 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/FloatAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/FloatAdapter.kt @@ -15,4 +15,6 @@ object FloatAdapter : TypeAdapter { null } } + + override fun toString() = "FloatAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/InstantAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/InstantAdapter.kt index ef5cf16..c465676 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/InstantAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/InstantAdapter.kt @@ -16,4 +16,6 @@ object InstantAdapter : TypeAdapter { null } } + + override fun toString() = "InstantAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/IntAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/IntAdapter.kt index 33c7d81..9d7bc27 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/IntAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/IntAdapter.kt @@ -15,4 +15,6 @@ object IntAdapter : TypeAdapter { null } } + + override fun toString() = "IntAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/IntAdapterAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/IntAdapterAdapter.kt index a4dc704..82cb7c2 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/IntAdapterAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/IntAdapterAdapter.kt @@ -16,4 +16,6 @@ object IntAdapterAdapter : TypeAdapter { null } } + + override fun toString() = "IntAdapterAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/JsonAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/JsonAdapter.kt index b5af7a8..91e184a 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/JsonAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/JsonAdapter.kt @@ -18,4 +18,6 @@ object JsonAdapter : TypeAdapter { null } } + + override fun toString() = "JsonAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/LocalDateAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/LocalDateAdapter.kt index a533ddf..42c10b1 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/LocalDateAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/LocalDateAdapter.kt @@ -16,4 +16,6 @@ object LocalDateAdapter : TypeAdapter { null } } + + override fun toString() = "LocalDateAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/LocalDateTimeAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/LocalDateTimeAdapter.kt index c9bceda..e246a49 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/LocalDateTimeAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/LocalDateTimeAdapter.kt @@ -16,4 +16,6 @@ object LocalDateTimeAdapter : TypeAdapter { null } } + + override fun toString() = "LocalDateTimeAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/LocalTimeAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/LocalTimeAdapter.kt index 19a2eb0..759b0b0 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/LocalTimeAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/LocalTimeAdapter.kt @@ -16,4 +16,6 @@ object LocalTimeAdapter : TypeAdapter { null } } + + override fun toString() = "LocalTimeAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/LongAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/LongAdapter.kt index 7dd7e0d..8c65518 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/LongAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/LongAdapter.kt @@ -15,4 +15,6 @@ object LongAdapter : TypeAdapter { null } } + + override fun toString() = "LongAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/MonthDayAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/MonthDayAdapter.kt index aa33053..10e44be 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/MonthDayAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/MonthDayAdapter.kt @@ -16,4 +16,6 @@ object MonthDayAdapter : TypeAdapter { null } } + + override fun toString() = "MonthDayAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/StringAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/StringAdapter.kt index 26a58f4..b40aad0 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/StringAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/StringAdapter.kt @@ -15,4 +15,6 @@ object StringAdapter : TypeAdapter { null } } + + override fun toString() = "StringAdapter" } \ No newline at end of file diff --git a/database/src/main/kotlin/cn/tursom/database/typeadapter/TimeAdapter.kt b/database/src/main/kotlin/cn/tursom/database/typeadapter/TimeAdapter.kt index 2cd5ec7..c97935a 100644 --- a/database/src/main/kotlin/cn/tursom/database/typeadapter/TimeAdapter.kt +++ b/database/src/main/kotlin/cn/tursom/database/typeadapter/TimeAdapter.kt @@ -16,4 +16,6 @@ object TimeAdapter : TypeAdapter