diff --git a/src/org/ntlab/pushPullRefactoring/PushPullProcessor.java b/src/org/ntlab/pushPullRefactoring/PushPullProcessor.java index c87884a..c18a7fb 100644 --- a/src/org/ntlab/pushPullRefactoring/PushPullProcessor.java +++ b/src/org/ntlab/pushPullRefactoring/PushPullProcessor.java @@ -540,7 +540,7 @@ String dstValue = annotationValueCase(descriptor.getDistinationClassName()); // @PushReference���t�^���ꂽ�t�B�[���h��lj� - String pushrefCode = "@PushReference(\"" + dstValue + "\")" + System.getProperty("line.separator") + "@Pullable" + String pushrefCode = "@PushReference(\"" + dstValue + "\")" + System.getProperty("line.separator") + "@Pullable(\"direct\")" + System.getProperty("line.separator") + "String " + dstValue + "= " + "\"/" + dstValue + "\";"; addStatement(srcUnitRewrite, srcUnit, srcDec[0], pushrefCode); @@ -642,11 +642,18 @@ } if (ptype.getType().toString().equals("Map.Entry")) { - result += ptype.toString() + " i = new ObjectMapper().readValue(" + srcNames[i] + result += convertType(ptype) + " i = new ObjectMapper().readValue(" + srcNames[i] + "_json, HashMap.class);" + System.getProperty("line.separator") + "\t"; - ; - result += srcNames[i] + " = new AbstractMap.SimpleEntry<>(i.entrySet().iterator.next.getKey(), " - + geterateParameterizedTypeStatements("i", "i", (Type) ptype.typeArguments().get(1)) + ")" + var mapValue = "i"; + var typeArg = ptype.typeArguments().get(1); + if(typeArg instanceof ParameterizedType) { + if(( (ParameterizedType) ptype.typeArguments().get(1)).getType().toString().equals("Map.Entry")){ + mapValue += ".entrySet().iterator().next().getValue()"; + } + } + + result += srcNames[i] + " = new AbstractMap.SimpleEntry<>(i.entrySet().iterator().next().getKey(), " + + geterateParameterizedTypeStatements("i", mapValue, (Type) ptype.typeArguments().get(1)) + ");" + System.getProperty("line.separator"); } }