Skip to content

Commit

Permalink
corrected packaged
Browse files Browse the repository at this point in the history
  • Loading branch information
tieskedh authored Oct 23, 2018
1 parent 84a92d3 commit 8493ff8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/kotlin/nl/devhaan/kotlinpoetdsl/helpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ package nl.devhaan.kotlinpoetdsl
import com.squareup.kotlinpoet.*

val EMPTY_CODEBLOCK = CodeBlock.builder().build()
fun TypeSpec.packaged(pack: String, vararg outerClasses: String) = ClassName.bestGuess((listOf(pack) + outerClasses).joinToString("."+name!!))

fun TypeSpec.packaged(pack: String, vararg outerClasses: String): ClassName {
return if (outerClasses.isEmpty()) ClassName(pack, name!!)
else ClassName.bestGuess((listOf(pack) + outerClasses+name!!).joinToString("."))
}
inline fun <reified T> typeNameFor(): ClassName {
val typeName = T::class.asTypeName()
return if (null is T) typeName.asNullable() else typeName.asNonNullable()
}
fun String.S() = "\"$this\""

fun TypeSpec.println() = println(this)
fun FunSpec.println() = println(this)
fun FunSpec.println() = println(this)

0 comments on commit 8493ff8

Please sign in to comment.