All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.airbnb.android.showkase.processor.utils.XProcessingExtensions.kt Maven / Gradle / Ivy

package com.airbnb.android.showkase.processor.utils

import androidx.room.compiler.processing.XAnnotated
import androidx.room.compiler.processing.XAnnotation
import androidx.room.compiler.processing.XElement
import com.airbnb.android.showkase.processor.exceptions.ShowkaseProcessorException

fun XAnnotated.findAnnotationBySimpleName(simpleName: String): XAnnotation? {
    return getAllAnnotations().find { it.name == simpleName }
}

fun XAnnotated.requireAnnotationBySimpleName(simpleName: String): List {
    return getAllAnnotations().filter { it.name == simpleName }
        ?: throw ShowkaseProcessorException(
            "No annotation named $simpleName found",
            this as? XElement
        )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy