Skip to content

Commit c428de9

Browse files
committed
Add support for mixed SQL annotation types in DAO interface
1 parent 2d7f3c1 commit c428de9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/main/kotlin/org/domaframework/doma/intellij/inspection/dao/processor/option/DaoAnnotationOptionParameterCheckProcessor.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,19 @@ class DaoAnnotationOptionParameterCheckProcessor(
170170

171171
private fun getMatchFields(paramClass: PsiClass?): List<PsiField> =
172172
paramClass?.allFields?.filter { f ->
173-
val parentClass = f.parent as? PsiClass
174-
(parentClass?.isEntity() == true || parentClass?.isEmbeddable() == true) &&
175-
(TypeUtil.isBaseOrOptionalWrapper(f.type) || TypeUtil.isEmbeddable(f.type, project))
173+
isValidMatchField(f)
176174
} ?: emptyList()
177175

176+
/**
177+
* Helper method to encapsulate field validation logic for getMatchFields.
178+
*/
179+
private fun isValidMatchField(f: PsiField): Boolean {
180+
val parentClass = f.parent as? PsiClass
181+
val isEntityOrEmbeddable = parentClass?.isEntity() == true || parentClass?.isEmbeddable() == true
182+
val isBaseOrEmbeddableType = TypeUtil.isBaseOrOptionalWrapper(f.type) || TypeUtil.isEmbeddable(f.type, project)
183+
return isEntityOrEmbeddable && isBaseOrEmbeddableType
184+
}
185+
178186
private fun getTargetOptionProperties(paramClass: PsiClass?) =
179187
getMatchFields(paramClass).joinToString(", ") { it.name.substringAfter(":") }
180188

0 commit comments

Comments
 (0)