diff --git a/src/org/ntlab/pushPullRefactoring/PushPullProcessor.java b/src/org/ntlab/pushPullRefactoring/PushPullProcessor.java index c5366dd..55e843a 100644 --- a/src/org/ntlab/pushPullRefactoring/PushPullProcessor.java +++ b/src/org/ntlab/pushPullRefactoring/PushPullProcessor.java @@ -1,6 +1,7 @@ package org.ntlab.pushPullRefactoring; import java.io.File; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -33,6 +34,7 @@ import org.eclipse.jdt.core.dom.ASTParser; import org.eclipse.jdt.core.dom.ASTVisitor; import org.eclipse.jdt.core.dom.Annotation; +import org.eclipse.jdt.core.dom.ArrayInitializer; import org.eclipse.jdt.core.dom.Block; import org.eclipse.jdt.core.dom.BodyDeclaration; import org.eclipse.jdt.core.dom.ChildListPropertyDescriptor; @@ -155,6 +157,7 @@ var srcUnit = descriptor.getSourceClass(); var dstUnit = descriptor.getDistinationClass(); var dstDec = new TypeDeclaration[1]; + var messages = searchMethodDeclarations(srcUnit, "Message" ); var md = searchMethodDeclaration(dstUnit, "Message", annotationValueCase(descriptor.getSourceClassName())); descriptor.getDistinationClass().accept(new ASTVisitor() { @Override @@ -204,6 +207,10 @@ addStatement(dstUnitRewrite, dstUnit, getter.getBody() ,getterStatements, Block.STATEMENTS_PROPERTY); replaceASTNode(dstUnitRewrite, dstUnit, returnStatement[0].getExpression(), transition[0]); + + //�]�����̕ύX + deletePutMethodInvocation(srcUnit); + // �V�K�t�@�C���쐬 try { IPath path = dstUnit.getJavaElement().getPath(); @@ -219,7 +226,22 @@ e.printStackTrace(); } } - + private void deletePutMethodInvocation(ASTNode srcNode) { + + } + private MethodDeclaration[] searchMethodDeclarations(CompilationUnit cu, String annotationName, String... values) { + List result = new ArrayList(); + cu.accept(new ASTVisitor() { + @Override + public boolean visit(MethodDeclaration node) { + if (hasMatchAnnotation(node, node.modifiers(), annotationName, values)) { + result.add(node); + } + return super.visit(node); + } + }); + return result.toArray(new MethodDeclaration[] {}); + } private String generateGetStatement(String assignedValue, String path, Type type) { String result = ""; String tmp = assignedValue; @@ -270,13 +292,6 @@ } } -// List> handsA_json = client.target("http://localhost:8080").path("/handsA").request().get(ArrayList.class); - // List> handsA = new ArrayList<>(); - // for (Map i: handsA_json) { - // handsA.add(new - // AbstractMap.SimpleEntry<>(Integer.parseInt(i.entrySet().iterator().next().getKey()), - // i.entrySet().iterator().next().getValue())); - // } return ""; } @@ -459,7 +474,18 @@ // annotation���l��1�‚̃A�m�e�[�V�����������ꍇ if (annotation instanceof SingleMemberAnnotation) { + if(values.length == 0)return true; SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation) annotation; + Expression tmp =singleMemberAnnotation.getValue(); + + IType itype = (IType)tmp.resolveTypeBinding().getJavaElement(); + String typename = itype.getTypeQualifiedName(); + if(tmp instanceof ArrayInitializer) { + + } + //if(tmp instanceof )) { + + //} // �A�m�e�[�V��������擾�����l����擪�Ɩ����̃_�u���N�H�[�e�[�V�������폜���������� String value = singleMemberAnnotation.getValue().toString().substring(1, singleMemberAnnotation.getValue().toString().length() - 1);