From 3efd75f76e0be551daef021d734524ac31880828 Mon Sep 17 00:00:00 2001 From: nekocode Date: Sat, 22 Apr 2017 02:06:18 +0800 Subject: [PATCH] Add support for nullable field --- META-INF/plugin.xml | 2 +- .../NormalArraySerializer.java | 16 +------- .../NullableArraySerializer.java | 38 +++++++++++++++++++ .../NullableStringSerializer.java | 36 ++++++++++++++++++ .../NullableValueSerializer.java | 37 ++++++++++++++++++ .../TypeSerializerFactory.java | 29 ++++++++++---- 6 files changed, 136 insertions(+), 22 deletions(-) create mode 100644 src/cn/nekocode/plugin/parcelablegenerator/typeserializers/NullableArraySerializer.java create mode 100644 src/cn/nekocode/plugin/parcelablegenerator/typeserializers/NullableStringSerializer.java create mode 100644 src/cn/nekocode/plugin/parcelablegenerator/typeserializers/NullableValueSerializer.java diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index 6bb4ce2..4a2fe25 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,7 +1,7 @@ cn.nekocode.plugin.parcelablegenerator Parcelable Code Generator(for kotlin) - 0.6.1 + 0.6.2 nekocode createTypeSerializers(java.util.List") || typeName.equals("ArrayList") || typeName.equals("MutableList")) { typeSerializers.add(new StringListSerializer(field)); - } else if (typeName.equals("Array") || typeName.equals("ByteArray") || typeName.equals("DoubleArray") || - typeName.equals("FloatArray") || typeName.equals("IntArray") || typeName.equals("LongArray") || - typeName.equals("CharArray") || typeName.equals("BooleanArray")) { + } else if (typeName.equals("Array") || typeName.equals("Array") || + typeName.equals("ByteArray") || typeName.equals("DoubleArray") || typeName.equals("FloatArray") || + typeName.equals("IntArray") || typeName.equals("LongArray") || typeName.equals("CharArray") || + typeName.equals("BooleanArray")) { typeSerializers.add(new OriginalArraySerializer(field)); } else if (typeName.equals("Array") || typeName.equals("Array") || typeName.equals("Array") || @@ -42,6 +52,11 @@ public static List createTypeSerializers(java.util.List")) { typeSerializers.add(new NormalArraySerializer(field)); + } else if (typeName.equals("Array") || typeName.equals("Array") || typeName.equals("Array") || + typeName.equals("Array") || typeName.equals("Array") || typeName.equals("Array") || + typeName.equals("Array")) { + typeSerializers.add(new NullableArraySerializer(field)); + } else { Collection supertypes;