From c46c9a7cd15b876aba45c9d0c2ea20051abe3574 Mon Sep 17 00:00:00 2001 From: Andrew Shu Date: Mon, 29 Feb 2016 22:55:19 -0800 Subject: [PATCH] DynamicFieldType: restore TypeConverter lookup ref GH-118 --- .../processor/type/field/DynamicFieldType.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/processor/src/main/java/com/bluelinelabs/logansquare/processor/type/field/DynamicFieldType.java b/processor/src/main/java/com/bluelinelabs/logansquare/processor/type/field/DynamicFieldType.java index 7cc0b96..ad934ea 100644 --- a/processor/src/main/java/com/bluelinelabs/logansquare/processor/type/field/DynamicFieldType.java +++ b/processor/src/main/java/com/bluelinelabs/logansquare/processor/type/field/DynamicFieldType.java @@ -1,6 +1,6 @@ package com.bluelinelabs.logansquare.processor.type.field; -import com.bluelinelabs.logansquare.processor.ObjectMapperInjector; +import com.bluelinelabs.logansquare.LoganSquare; import com.squareup.javapoet.MethodSpec.Builder; import com.squareup.javapoet.TypeName; @@ -30,8 +30,8 @@ public TypeName getNonPrimitiveTypeName() { @Override public void parse(Builder builder, int depth, String setter, Object... setterFormatArgs) { - setter = replaceLastLiteral(setter, ObjectMapperInjector.getTypeConverterGetter(mTypeName) + "().parse($L)"); - builder.addStatement(setter, expandStringArgs(setterFormatArgs, JSON_PARSER_VARIABLE_NAME)); + setter = replaceLastLiteral(setter, "$T.typeConverterFor($T.class).parse($L)"); + builder.addStatement(setter, expandStringArgs(setterFormatArgs, LoganSquare.class, mTypeName, JSON_PARSER_VARIABLE_NAME)); } @Override @@ -40,7 +40,8 @@ public void serialize(Builder builder, int depth, String fieldName, List builder.beginControlFlow("if ($L != null)", getter); } - builder.addStatement(ObjectMapperInjector.getTypeConverterGetter(mTypeName) + "().serialize($L, $S, $L, $L)", getter, isObjectProperty ? fieldName : null, isObjectProperty, JSON_GENERATOR_VARIABLE_NAME); + builder.addStatement("$T.typeConverterFor($T.class).serialize($L, $S, $L, $L)", LoganSquare.class, mTypeName, getter, isObjectProperty + ? fieldName : null, isObjectProperty, JSON_GENERATOR_VARIABLE_NAME); if (!mTypeName.isPrimitive() && checkIfNull) { if (writeIfNull) {