本文整理汇总了Java中org.gsonformat.intellij.config.Constant类的典型用法代码示例。如果您正苦于以下问题:Java Constant类的具体用法?Java Constant怎么用?Java Constant使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Constant类属于org.gsonformat.intellij.config包,在下文中一共展示了Constant类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateField
import org.gsonformat.intellij.config.Constant; //导入依赖的package包/类
@Override
protected void generateField(PsiElementFactory factory, FieldEntity fieldEntity, PsiClass cls, ClassEntity classEntity) {
if (fieldEntity.isGenerate()) {
Try.run(new Try.TryListener() {
@Override
public void run() {
cls.add(factory.createFieldFromText(generateLombokFieldText(classEntity, fieldEntity,null), cls));
}
@Override
public void runAgain() {
fieldEntity.setFieldName(FieldHelper.generateLuckyFieldName(fieldEntity.getFieldName()));
cls.add(factory.createFieldFromText(generateLombokFieldText(classEntity, fieldEntity, Constant.FIXME), cls));
}
@Override
public void error() {
cls.addBefore(factory.createCommentFromText("// FIXME generate failure field " + fieldEntity.getFieldName(), cls), cls.getChildren()[0]);
}
});
}
}
示例2: generateField
import org.gsonformat.intellij.config.Constant; //导入依赖的package包/类
@Override
public void generateField(PsiElementFactory factory, FieldEntity fieldEntity, PsiClass cls, ClassEntity classEntity) {
if (fieldEntity.isGenerate()) {
Try.run(new Try.TryListener() {
@Override
public void run() {
cls.add(factory.createMethodFromText(generateFieldText(classEntity, fieldEntity, null), cls));
}
@Override
public void runAgain() {
fieldEntity.setFieldName(FieldHelper.generateLuckyFieldName(fieldEntity.getFieldName()));
cls.add(factory.createMethodFromText(generateFieldText(classEntity, fieldEntity, Constant.FIXME), cls));
}
@Override
public void error() {
cls.addBefore(factory.createCommentFromText("// FIXME generate failure field " + fieldEntity.getFieldName(), cls), cls.getChildren()[0]);
}
});
}
}
示例3: generateFieldText
import org.gsonformat.intellij.config.Constant; //导入依赖的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: generateField
import org.gsonformat.intellij.config.Constant; //导入依赖的package包/类
protected void generateField(PsiElementFactory factory, FieldEntity fieldEntity, PsiClass cls, ClassEntity classEntity) {
if (fieldEntity.isGenerate()) {
Try.run(new Try.TryListener() {
@Override
public void run() {
cls.add(factory.createFieldFromText(generateFieldText(classEntity, fieldEntity, null), cls));
}
@Override
public void runAgain() {
fieldEntity.setFieldName(FieldHelper.generateLuckyFieldName(fieldEntity.getFieldName()));
cls.add(factory.createFieldFromText(generateFieldText(classEntity, fieldEntity, Constant.FIXME), cls));
}
@Override
public void error() {
cls.addBefore(factory.createCommentFromText("// FIXME generate failure field " + fieldEntity.getFieldName(), cls), cls.getChildren()[0]);
}
});
}
}
示例5: resetAction
import org.gsonformat.intellij.config.Constant; //导入依赖的package包/类
private void resetAction() {
switch (type) {
case OBJECT_FROM_DATA:
editTP.setText(Constant.objectFromObject);
break;
case OBJECT_FROM_DATA1:
System.out.println(Constant.objectFromObject1);
editTP.setText(Constant.objectFromObject1);
break;
case ARRAY_FROM_DATA:
editTP.setText(Constant.arrayFromData);
break;
case ARRAY_FROM_DATA1:
editTP.setText(Constant.arrayFromData1);
break;
}
}
示例6: generateLuckyFieldName
import org.gsonformat.intellij.config.Constant; //导入依赖的package包/类
public static String generateLuckyFieldName(String name) {
if (name == null) {
return Constant.DEFAULT_PREFIX + new Random().nextInt(333);
}
Matcher matcher = Pattern.compile("(\\w+)").matcher(name);
StringBuilder sb = new StringBuilder("_$");
while (matcher.find()) {
sb.append(StringUtils.captureName(matcher.group(1)));
}
return sb.append(new Random().nextInt(333)).toString();
}
示例7: handleArg
import org.gsonformat.intellij.config.Constant; //导入依赖的package包/类
public String handleArg(String arg) {
arg = arg.replaceAll("-", "");
Matcher matcher = sPattern.matcher(arg);
if (matcher.find()) {
return Constant.DEFAULT_PREFIX + arg;
} else {
if (CheckUtil.getInstant().checkKeyWord(arg)) {
return arg + "X";
}
return arg;
}
}