本文整理汇总了Java中org.gsonformat.intellij.config.Config类的典型用法代码示例。如果您正苦于以下问题:Java Config类的具体用法?Java Config怎么用?Java Config使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Config类属于org.gsonformat.intellij.config包,在下文中一共展示了Config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSubClassName
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
private String createSubClassName(String key, Object o) {
String name = "";
if (o instanceof JSONObject) {
if (TextUtils.isEmpty(key)) {
return key;
}
String[] strings = key.split("_");
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < strings.length; i++) {
stringBuilder.append(StringUtils.captureName(strings[i]));
}
name = stringBuilder.toString() + Config.getInstant().getSuffixStr();
}
return name;
}
示例2: generateLombokFieldText
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
private String generateLombokFieldText(ClassEntity classEntity, FieldEntity fieldEntity, String fixme) {
fixme = fixme == null ? "" : fixme;
StringBuilder fieldSb = new StringBuilder();
String filedName = fieldEntity.getGenerateFieldName();
if (!TextUtils.isEmpty(classEntity.getExtra())) {
fieldSb.append(classEntity.getExtra()).append("\n");
classEntity.setExtra(null);
}
if (fieldEntity.getTargetClass() != null) {
fieldEntity.getTargetClass().setGenerate(true);
}
if (Config.getInstant().isFieldPrivateMode()) {
fieldSb.append("private ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
} else {
fieldSb.append("public ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
}
return fieldSb.append(fixme).toString();
}
示例3: generateFieldText
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
private String generateFieldText(ClassEntity classEntity, FieldEntity fieldEntity, String fixme) {
fixme = fixme == null ? "" : fixme;
StringBuilder fieldSb = new StringBuilder();
String fieldName = fieldEntity.getGenerateFieldName();
if (!TextUtils.isEmpty(classEntity.getExtra())) {
fieldSb.append(classEntity.getExtra()).append("\n");
classEntity.setExtra(null);
}
if (!fieldName.equals(fieldEntity.getKey()) || Config.getInstant().isUseSerializedName()) {
fieldSb.append(Constant.gsonFullNameAnnotation.replaceAll("\\{filed\\}", fieldEntity.getKey()));
}
if (fieldEntity.getTargetClass() != null) {
fieldEntity.getTargetClass().setGenerate(true);
}
return fieldSb.append(String.format("public abstract %s %s(); " + fixme, fieldEntity.getFullNameType(), fieldName)).toString();
}
示例4: generateConvertMethod
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
protected void generateConvertMethod(PsiElementFactory factory, PsiClass cls, ClassEntity classEntity) {
if (cls == null || cls.getName() == null) {
return;
}
if (Config.getInstant().isObjectFromData()) {
createMethod(factory, Config.getInstant().getObjectFromDataStr().replace("$ClassName$", cls.getName()).trim(), cls);
}
if (Config.getInstant().isObjectFromData1()) {
createMethod(factory, Config.getInstant().getObjectFromDataStr1().replace("$ClassName$", cls.getName()).trim(), cls);
}
if (Config.getInstant().isArrayFromData()) {
createMethod(factory, Config.getInstant().getArrayFromDataStr().replace("$ClassName$", cls.getName()).trim(), cls);
}
if (Config.getInstant().isArrayFromData1()) {
createMethod(factory, Config.getInstant().getArrayFromData1Str().replace("$ClassName$", cls.getName()).trim(), cls);
}
}
示例5: generateFieldText
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
private String generateFieldText(ClassEntity classEntity, FieldEntity fieldEntity, String fixme) {
fixme = fixme == null ? "" : fixme;
StringBuilder fieldSb = new StringBuilder();
String filedName = fieldEntity.getGenerateFieldName();
if (!TextUtils.isEmpty(classEntity.getExtra())) {
fieldSb.append(classEntity.getExtra()).append("\n");
classEntity.setExtra(null);
}
if (fieldEntity.getTargetClass() != null) {
fieldEntity.getTargetClass().setGenerate(true);
}
if (!filedName.equals(fieldEntity.getKey()) || Config.getInstant().isUseSerializedName()) {
fieldSb.append(Config.getInstant().geFullNameAnnotation().replaceAll("\\{filed\\}", fieldEntity.getKey()));
}
if (Config.getInstant().isFieldPrivateMode()) {
fieldSb.append("private ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
} else {
fieldSb.append("public ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
}
return fieldSb.append(fixme).toString();
}
示例6: onOK
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
private void onOK() {
switch (type) {
case OBJECT_FROM_DATA:
Config.getInstant().saveObjectFromDataStr(editTP.getText());
break;
case OBJECT_FROM_DATA1:
Config.getInstant().saveObjectFromDataStr1(editTP.getText());
break;
case ARRAY_FROM_DATA:
Config.getInstant().saveArrayFromDataStr(editTP.getText());
break;
case ARRAY_FROM_DATA1:
Config.getInstant().saveArrayFromData1Str(editTP.getText());
break;
}
dispose();
}
示例7: onOK
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
private void onOK() {
Config.getInstant().setFieldPrivateMode(fieldPrivateRadioButton.isSelected());
Config.getInstant().setUseSerializedName(useSerializedNameCheckBox.isSelected());
Config.getInstant().setArrayFromData(arrayFromDataCB.isSelected());
Config.getInstant().setArrayFromData1(arrayFromData1CB.isSelected());
Config.getInstant().setObjectFromData(objectFromDataCB.isSelected());
Config.getInstant().setObjectFromData1(objectFromData1CB.isSelected());
Config.getInstant().setReuseEntity(reuseEntityCB.isSelected());
Config.getInstant().setSuffixStr(suffixEdit.getText());
Config.getInstant().setVirgoMode(virgoModelCB.isSelected());
Config.getInstant().setGenerateComments(generateCommentsCT.isSelected());
Config.getInstant().setFiledNamePreFixStr(filedPrefixTF.getText());
Config.getInstant().setAnnotationStr(annotationFT.getText());
Config.getInstant().setUseFieldNamePrefix(filedPrefixCB.isSelected());
Config.getInstant().setSplitGenerate(splitGenerateMode.isSelected());
Config.getInstant().setUseWrapperClass(useWrapperClassCB.isSelected());
Config.getInstant().save();
dispose();
}
示例8: showError
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
@Override
public void showError(ConvertBridge.Error err) {
switch (err) {
case DATA_ERROR:
errorLB.setText("data err !!");
if (Config.getInstant().isToastError()) {
Toast.make(project, errorLB, MessageType.ERROR, "click to see details");
}
break;
case PARSE_ERROR:
errorLB.setText("parse err !!");
if (Config.getInstant().isToastError()) {
Toast.make(project, errorLB, MessageType.ERROR, "click to see details");
}
break;
case PATH_ERROR:
Toast.make(project, generateClassP, MessageType.ERROR, "the path is not allowed");
break;
}
}
示例9: generateLombokFieldText
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
private String generateLombokFieldText(ClassEntity classEntity, FieldEntity fieldEntity,String fixme) {
fixme = fixme == null ? "" : fixme;
StringBuilder fieldSb = new StringBuilder();
String filedName = fieldEntity.getGenerateFieldName();
if (!TextUtils.isEmpty(classEntity.getExtra())) {
fieldSb.append(classEntity.getExtra()).append("\n");
classEntity.setExtra(null);
}
if (fieldEntity.getTargetClass() != null) {
fieldEntity.getTargetClass().setGenerate(true);
}
if (Config.getInstant().isFieldPrivateMode()) {
fieldSb.append("private ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
} else {
fieldSb.append("public ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
}
return fieldSb.append(fixme).toString();
}
示例10: onOK
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
private void onOK() {
Config.getInstant().setFieldPrivateMode(fieldPrivateRadioButton.isSelected());
Config.getInstant().setUseSerializedName(useSerializedNameCheckBox.isSelected());
Config.getInstant().setArrayFromData(arrayFromDataCB.isSelected());
Config.getInstant().setArrayFromData1(arrayFromData1CB.isSelected());
Config.getInstant().setObjectFromData(objectFromDataCB.isSelected());
Config.getInstant().setObjectFromData1(objectFromData1CB.isSelected());
Config.getInstant().setReuseEntity(reuseEntityCB.isSelected());
Config.getInstant().setSuffixStr(suffixEdit.getText());
Config.getInstant().setVirgoMode(virgoModelCB.isSelected());
Config.getInstant().setGenerateComments(generateCommentsCT.isSelected());
Config.getInstant().setFiledNamePreFixStr(filedPrefixTF.getText());
Config.getInstant().setAnnotationStr(annotationFT.getText());
Config.getInstant().setUseFieldNamePrefix(filedPrefixCB.isSelected());
Config.getInstant().setSplitGenerate(splitGenerateMode.isSelected());
Config.getInstant().save();
dispose();
}
示例11: ConvertBridge
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
public ConvertBridge(Operator operator,
String jsonStr, PsiFile file, Project project,
PsiClass targetClass,
PsiClass currentClass, String generateClassName) {
factory = JavaPsiFacade.getElementFactory(project);
this.file = file;
this.generateClassName = generateClassName;
this.operator = operator;
this.jsonStr = jsonStr;
this.project = project;
this.targetClass = targetClass;
this.currentClass = currentClass;
declareFields = new HashMap<>();
declareClass = new HashMap<>();
packageName = StringUtils.getPackage(generateClassName);
fullFilterRegex = new StringBuilder();
briefFilterRegex = new StringBuilder();
CheckUtil.getInstant().cleanDeclareData();
String[] arg = Config.getInstant().getAnnotationStr().replace("{filed}", "(\\w+)").split("\\.");
for (int i = 0; i < arg.length; i++) {
String s = arg[i];
if (i == arg.length - 1) {
briefFilterRegex.append(s);
fullFilterRegex.append(s);
Matcher matcher = Pattern.compile("\\w+").matcher(s);
if (matcher.find()) {
filterRegex = matcher.group();
}
} else {
fullFilterRegex.append(s).append("\\s*\\.\\s*");
}
}
}
示例12: parseJson
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
private void parseJson(JSONObject json) {
List<String> generateFiled = collectGenerateFiled(json);
if (Config.getInstant().isVirgoMode()) {
handleVirgoMode(json, generateFiled);
} else {
handleNormal(json, generateFiled);
}
}
示例13: handleNormal
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
private void handleNormal(JSONObject json, List<String> generateFiled) {
WriteCommandAction.runWriteCommandAction(project, new Runnable() {
@Override
public void run() {
if (targetClass == null) {
try {
targetClass = PsiClassUtil.getPsiClass(file, project, generateClassName);
} catch (Throwable throwable) {
handlePathError(throwable);
}
}
if (targetClass != null) {
generateClassEntity.setPsiClass(targetClass);
try {
generateClassEntity.addAllFields(createFields(json, generateFiled, generateClassEntity));
operator.setVisible(false);
DataWriter dataWriter = new DataWriter(file, project, targetClass);
dataWriter.execute(generateClassEntity);
Config.getInstant().saveCurrentPackPath(packageName);
operator.dispose();
} catch (Exception e) {
throw e;
}
}
}
});
}
示例14: createField
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
private FieldEntity createField(ClassEntity parentClass, String key, Object type) {
//过滤 不符合规则的key
String fieldName = CheckUtil.getInstant().handleArg(key);
if (Config.getInstant().isUseSerializedName()) {
fieldName = StringUtils.captureStringLeaveUnderscore(convertSerializedName(fieldName));
}
fieldName = handleDeclareFieldName(fieldName, "");
FieldEntity fieldEntity = typeByValue(parentClass, key, type);
fieldEntity.setFieldName(fieldName);
return fieldEntity;
}
示例15: convertSerializedName
import org.gsonformat.intellij.config.Config; //导入依赖的package包/类
private String convertSerializedName(String fieldName) {
if (Config.getInstant().isUseFieldNamePrefix() &&
!TextUtils.isEmpty(Config.getInstant().getFiledNamePreFixStr())) {
fieldName = Config.getInstant().getFiledNamePreFixStr() + "_" + fieldName;
}
return fieldName;
}