Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
修正: 删除auto value 的适配器生成方法.
  • Loading branch information
zzz40500 committed Jan 22, 2017
1 parent fcbb1f4 commit 9862101
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
Binary file modified .DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public void generateGetterAndSetter(PsiElementFactory factory, PsiClass cls, Cla
@Override
public void generateConvertMethod(PsiElementFactory factory, PsiClass cls, ClassEntity classEntity) {
super.generateConvertMethod(factory, cls, classEntity);
if (PsiClassUtil.isClassAvailableForProject(cls.getProject(), "com.ryanharter.auto.value.gson.AutoValueGsonAdapterFactoryProcessor")) {
String qualifiedName = cls.getQualifiedName();
String autoAdapter = qualifiedName.substring(mainPackage.length(), qualifiedName.length());
createMethod(factory, Constant.autoValueMethodTemplate.replace("$className$", classEntity.getClassName()).replace("$AdapterClassName$", getAutoAdpaterClass(autoAdapter)).trim(), cls);
}
// if (PsiClassUtil.isClassAvailableForProject(cls.getProject(), "com.ryanharter.auto.value.gson.AutoValueGsonAdapterFactoryProcessor")) {
// String qualifiedName = cls.getQualifiedName();
// String autoAdapter = qualifiedName.substring(mainPackage.length()+1, qualifiedName.length());
// createMethod(factory, Constant.autoValueMethodTemplate.replace("$className$", classEntity.getClassName()).replace("$AdapterClassName$", getAutoAdpaterClass(autoAdapter)).trim(), cls);
// }
}

public static String getAutoAdpaterClass(String className) {
Expand Down Expand Up @@ -96,9 +96,12 @@ private String generateFieldText(ClassEntity classEntity, FieldEntity fieldEntit
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.toString() + String.format("public abstract %s %s() ; " + fixme, fieldEntity.getFullNameType(), fieldName);
return fieldSb.append(String.format("\npublic abstract %s %s() ; " + fixme, fieldEntity.getFullNameType(), fieldName)).toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@
<member id="9cd04"/>
<member id="58b2a"/>
<member id="52216"/>
<member id="640f2"/>
</group>
</buttonGroups>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void actionPerformed(ActionEvent actionEvent) {
lombokRB.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
if (loganSquareCB.isSelected()) {
if (lombokRB.isSelected()) {
annotationFT.setText(Constant.lombokAnnotation);
}
annotationFT.setEnabled(otherRB.isSelected());
Expand Down

0 comments on commit 9862101

Please sign in to comment.