Skip to content

Commit

Permalink
refactor: StringUtils 依赖替换
Browse files Browse the repository at this point in the history
  • Loading branch information
fit2-zhao committed May 9, 2024
1 parent d0586cc commit 5f2dfbe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/metersphere/model/FieldWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.intellij.psi.util.PsiUtil;
import lombok.Data;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.metersphere.AppSettingService;
import org.metersphere.constants.ExcludeFieldConstants;
import org.metersphere.constants.JavaTypeEnum;
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/org/metersphere/utils/JsonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.javadoc.PsiDocTag;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.PsiUtil;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.metersphere.AppSettingService;
import org.metersphere.constants.JavaTypeEnum;
import org.metersphere.constants.PluginConstants;
Expand Down Expand Up @@ -356,7 +355,7 @@ else if (PsiTypeUtil.isCollection(field.getType())) {
private static void getFormDataBeansMap(List<PostmanModel.ItemBean.RequestBean.BodyBean.FormDataBean> param, PsiField field, String prefixField, int curDeepth, int maxDeepth) {
if (curDeepth == maxDeepth)
return;
prefixField = org.apache.commons.lang3.StringUtils.isNotBlank(prefixField) ? prefixField : "";
prefixField = StringUtils.isNotBlank(prefixField) ? prefixField : "";
param.add(new PostmanModel.ItemBean.RequestBean.BodyBean.FormDataBean(prefixField + "." + field.getName() + ".key", "text", null, null));
}

Expand All @@ -365,7 +364,7 @@ private static void getFormDataBeansPojo(List<PostmanModel.ItemBean.RequestBean.
return;
AppSettingState state = ApplicationManager.getApplication().getService(AppSettingService.class).getState();
PsiClass psiClass = PsiTypeUtil.getPsiClass(fatherField.getType(), fatherField.getProject(), "pojo");
prefixField = org.apache.commons.lang3.StringUtils.isNotBlank(prefixField) ? prefixField : "";
prefixField = StringUtils.isNotBlank(prefixField) ? prefixField : "";
if (psiClass != null) {
if (PluginConstants.simpleJavaType.contains(psiClass.getName())) {
param.add(new PostmanModel.ItemBean.RequestBean.BodyBean.FormDataBean(prefixField, "text", PluginConstants.simpleJavaTypeValue.get(psiClass.getName()), FieldUtil.getJavaDocName(psiClass, state, true)));
Expand Down Expand Up @@ -400,7 +399,7 @@ private static void getFormDataBeansArray(List<PostmanModel.ItemBean.RequestBean
return;
AppSettingState state = ApplicationManager.getApplication().getService(AppSettingService.class).getState();
PsiClass psiClass = PsiTypeUtil.getPsiClass(fatherField.getType(), fatherField.getProject(), "array");
prefixField = org.apache.commons.lang3.StringUtils.isNotBlank(prefixField) ? prefixField : "";
prefixField = StringUtils.isNotBlank(prefixField) ? prefixField : "";
if (psiClass != null) {
if (PluginConstants.simpleJavaType.contains(psiClass.getName())) {
param.add(new PostmanModel.ItemBean.RequestBean.BodyBean.FormDataBean(prefixField, "text", PluginConstants.simpleJavaTypeValue.get(psiClass.getName()), FieldUtil.getJavaDocName(psiClass, state, false)));
Expand Down Expand Up @@ -435,7 +434,7 @@ private static void getFormDataBeansCollection(List<PostmanModel.ItemBean.Reques
return;
AppSettingState state = ApplicationManager.getApplication().getService(AppSettingService.class).getState();
PsiClass psiClass = PsiTypeUtil.getPsiClass(fatherField, "collection");
prefixField = org.apache.commons.lang3.StringUtils.isNotBlank(prefixField) ? prefixField : "";
prefixField = StringUtils.isNotBlank(prefixField) ? prefixField : "";
if (psiClass != null) {
if (PluginConstants.simpleJavaType.contains(psiClass.getName())) {
param.add(new PostmanModel.ItemBean.RequestBean.BodyBean.FormDataBean(prefixField, "text", PluginConstants.simpleJavaTypeValue.get(psiClass.getName()), FieldUtil.getJavaDocName(psiClass, state, false)));
Expand Down

0 comments on commit 5f2dfbe

Please sign in to comment.