private void injectAnnotation(PsiElementFactory factory, PsiClass generateClass) { if (factory == null || generateClass == null) { return; } PsiModifierList modifierList = generateClass.getModifierList(); PsiElement firstChild = modifierList.getFirstChild(); Pattern pattern = Pattern.compile("@.*?JsonIgnoreProperties"); if (firstChild != null && !pattern.matcher(firstChild.getText()).find()) { PsiAnnotation annotationFromText = factory.createAnnotationFromText("@com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true)", generateClass); modifierList.addBefore(annotationFromText, firstChild); } } }
private void injectAnnotation(PsiElementFactory factory, PsiClass generateClass) { if (factory == null || generateClass == null) { return; } PsiModifierList modifierList = generateClass.getModifierList(); if (modifierList != null) { PsiElement firstChild = modifierList.getFirstChild(); Pattern pattern = Pattern.compile("@.*?NoArgsConstructor"); if (firstChild != null && !pattern.matcher(firstChild.getText()).find()) { PsiAnnotation annotationFromText = factory.createAnnotationFromText("@lombok.NoArgsConstructor", generateClass); modifierList.addBefore(annotationFromText, firstChild); } Pattern pattern2 = Pattern.compile("@.*?Data"); if (firstChild != null && !pattern2.matcher(firstChild.getText()).find()) { PsiAnnotation annotationFromText = factory.createAnnotationFromText("@lombok.Data", generateClass); modifierList.addBefore(annotationFromText, firstChild); } } }
private void injectAnnotation(PsiElementFactory factory, PsiClass generateClass) { if (factory == null || generateClass == null) { return; } PsiModifierList modifierList = generateClass.getModifierList(); if (modifierList != null) { PsiElement firstChild = modifierList.getFirstChild(); Pattern pattern = Pattern.compile("@.*?JsonObject"); if (firstChild != null && !pattern.matcher(firstChild.getText()).find()) { PsiAnnotation annotationFromText = factory.createAnnotationFromText("@com.bluelinelabs.logansquare.annotation.JsonObject", generateClass); modifierList.addBefore(annotationFromText, firstChild); } } } }
private void injectAutoAnnotation(PsiElementFactory factory, PsiClass cls) { PsiModifierList modifierList = cls.getModifierList(); if (modifierList != null) { PsiElement firstChild = modifierList.getFirstChild(); Pattern pattern = Pattern.compile("@.*?AutoValue"); if (firstChild != null && !pattern.matcher(firstChild.getText()).find()) { PsiAnnotation annotationFromText = factory.createAnnotationFromText("@com.google.auto.value.AutoValue", cls); modifierList.addBefore(annotationFromText, firstChild); } if (!modifierList.hasModifierProperty(PsiModifier.ABSTRACT)) { modifierList.setModifierProperty(PsiModifier.ABSTRACT, true); } } }