forked from rockjava/intellij-mybatis-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
检查XML增加快速修复对应方法,包括创建方法,入参和返回类型检测 / 快速修复
- Loading branch information
Sealin
committed
May 22, 2018
1 parent
a99e463
commit 5700dc0
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
src/main/java/com/wuzhizhan/mybatis/inspection/MapperMethodQuickFix.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.wuzhizhan.mybatis.inspection; | ||
|
||
import com.intellij.codeInspection.ProblemDescriptor; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.util.xml.GenericDomValue; | ||
import com.wuzhizhan.mybatis.generate.MethodGenerator; | ||
import org.jetbrains.annotations.Nls; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* @author Sealin | ||
* Created by Sealin on 2018-05-19. | ||
*/ | ||
public class MapperMethodQuickFix { | ||
static class MethodFixer extends GenericQuickFix { | ||
private GenericDomValue domValue; | ||
private boolean fixMode; | ||
|
||
/** | ||
* @param domValue domNode | ||
*/ | ||
public MethodFixer(GenericDomValue domValue) { | ||
this.domValue = domValue; | ||
} | ||
|
||
@Nls | ||
@NotNull | ||
@Override | ||
public String getName() { | ||
return "Create method"; | ||
} | ||
|
||
@Override | ||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { | ||
MethodGenerator.generateMethod(domValue); | ||
} | ||
} | ||
|
||
|
||
static class ParameterFixer extends GenericQuickFix { | ||
private GenericDomValue domValue; | ||
|
||
public ParameterFixer(GenericDomValue domValue) { | ||
this.domValue = domValue; | ||
} | ||
|
||
@Nls | ||
@NotNull | ||
@Override | ||
public String getName() { | ||
return "Fix error type"; | ||
} | ||
|
||
@Override | ||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { | ||
MethodGenerator.generateParameter(domValue); | ||
} | ||
} | ||
} |