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

utils.TypeElementExtension.kt Maven / Gradle / Ivy

There is a newer version: 1.0.4
Show newest version
package com.github.rougsig.diffdispatcherktx.processor.utils

import com.squareup.kotlinpoet.ClassName
import com.squareup.kotlinpoet.ParameterizedTypeName
import com.squareup.kotlinpoet.asTypeName
import javax.lang.model.element.Element
import javax.lang.model.element.ElementKind
import javax.lang.model.element.PackageElement

val Element.className: ClassName
  get() {
    val typeName = asType().asTypeName()
    return when (typeName) {
      is ClassName -> typeName
      is ParameterizedTypeName -> typeName.rawType
      else -> throw IllegalStateException("unexpected TypeName: ${typeName::class}")
    }
  }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy