gsonpath.extension.android.def.DefFunctions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gsonpath-extension-android Show documentation
Show all versions of gsonpath-extension-android Show documentation
A Gson Path extension library that adds Android support
package gsonpath.extension.android.def
import gsonpath.extension.android.getAnnotationMirror
import javax.lang.model.element.AnnotationMirror
import javax.lang.model.element.Element
data class DefAnnotationMirrors(val annotationMirror: AnnotationMirror, val defAnnotationMirror: AnnotationMirror)
fun getDefAnnotationMirrors(element: Element, packageName: String, className: String): DefAnnotationMirrors? {
val definitionAnnotation: AnnotationMirror = element.annotationMirrors?.find {
getAnnotationMirror(it.annotationType.asElement(), packageName, className) != null
} ?: return null
val stringDefAnnotationMirror = getAnnotationMirror(definitionAnnotation.annotationType.asElement(),
packageName, className) ?: return null
return DefAnnotationMirrors(definitionAnnotation, stringDefAnnotationMirror)
}