diff --git a/src/org/ntlab/pushPullRefactoring/PushPullProcessor.java b/src/org/ntlab/pushPullRefactoring/PushPullProcessor.java index 473e9fa..b11dd59 100644 --- a/src/org/ntlab/pushPullRefactoring/PushPullProcessor.java +++ b/src/org/ntlab/pushPullRefactoring/PushPullProcessor.java @@ -329,28 +329,54 @@ } private String generateGetStatement(String assignedValue, String path, Type type) { + //�Ԃ��{�f�B�S�̂̃\�[�X�R�[�h String result = ""; + //�]�����̒l��������ϐ��� String tmp = assignedValue; + //GET���\�b�h�̈����œn���^�� String simpleType = type.toString(); if (type instanceof ParameterizedType) { ParameterizedType ptype = (ParameterizedType) type; if (ptype.getType().toString().equals("List")) { + simpleType = "ArrayList"; + tmp = assignedValue + "_json"; + + result += "List<" + convertType((Type) ptype.typeArguments().get(0)) + "> "; + result += tmp + " = client.target(\"http://localhost:8080\").path(\"/" + path + "\").request().get(" + + simpleType + ".class);" + System.getProperty("line.separator"); + result += "List<" + ptype.typeArguments().get(0) + "> " + assignedValue + " = new ArrayList<>();" + System.getProperty("line.separator"); + + + result += geterateParameterizedTypeStatements(assignedValue, tmp, type); + } + if (ptype.getType().toString().equals("Map.Entry")) { + simpleType = "HashMap"; tmp = assignedValue + "_json"; - result += "List<" + convertType((Type) ptype.typeArguments().get(0)) + "> "; - simpleType = "ArrayList"; + result += convertType((Type) ptype) +" " ; + result += tmp + " = client.target(\"http://localhost:8080\").path(\"/" + path + "\").request().get(" + + simpleType + ".class);" + System.getProperty("line.separator"); + + result += (Type) ptype + " " + assignedValue + + " = new AbstractMap.SimpleEntry<>(" + + tmp +".entrySet().iterator().next().getKey(), " + + geterateParameterizedTypeStatements(assignedValue , tmp+ ".entrySet().iterator().next().getValue()",(Type) ptype.typeArguments().get(1)) + +");" + System.getProperty("line.separator"); + + //result += convertType((Type) ptype.typeArguments().get(0)); + + } } - result += tmp + " = client.target(\"http://localhost:8080\").path(\"/" + path + "\").request().get(" - + simpleType + ".class);" + System.getProperty("line.separator"); - result += geterateParameterizedTypeStatements(assignedValue, tmp, type); + + return result; } /** - * Map.Entry��Map�ɕϊ����郁�\�b�h + * Map.Entry��Map�ɕϊ����郁�\�b�h * @param type * @return */ @@ -376,9 +402,14 @@ return str; } if (ptype.getType().toString().equals("Map.Entry")) { + String parsedKey =""; + if(ptype.typeArguments().get(0).toString().equals("Integer")) { + parsedKey += ptype.typeArguments().get(0) + ".parseInt(" + tmpValue + ".entrySet().iterator().next().getKey())"; + }else { + parsedKey += tmpValue + ".entrySet().iterator().next().getKey()"; + } // parseInt���܂��ł��ĂȂ� - String str = "new AbstractMap.SimpleEntry<>(" + ptype.typeArguments().get(0) + ".parseInt(" + tmpValue - + ".entrySet().iterator().next().getKey()), " + tmpValue + String str = "new AbstractMap.SimpleEntry<>(" + parsedKey +", " + tmpValue + ".entrySet().iterator().next().getValue())"; return str; }