Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jangalinski committed Jun 21, 2024
1 parent 358bc03 commit f3d751d
Show file tree
Hide file tree
Showing 22 changed files with 35 additions and 36 deletions.
18 changes: 0 additions & 18 deletions kotlin-code-generation/src/main/kotlin/_builder.kt

This file was deleted.

2 changes: 2 additions & 0 deletions kotlin-code-generation/src/main/kotlin/_types.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.toolisticon.kotlin.generation

import io.toolisticon.kotlin.generation.poet.PoetSpecSupplier
import io.toolisticon.kotlin.generation.spec.*
import java.util.function.Supplier


/**
Expand All @@ -11,4 +12,5 @@ fun interface Builder<PRODUCT : Any> {
fun build(): PRODUCT
}

interface BuilderSupplier<P : Any, B : Any> : Builder<P>, Supplier<B>

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.toolisticon.kotlin.generation.builder

import com.squareup.kotlinpoet.ClassName
import com.squareup.kotlinpoet.KModifier
import com.squareup.kotlinpoet.TypeSpec
import io.toolisticon.kotlin.generation.BuilderSupplier
import io.toolisticon.kotlin.generation.poet.TypeSpecBuilder
Expand All @@ -25,6 +26,10 @@ class KotlinAnnotationClassSpecBuilder internal constructor(
)
}

init {
delegate.addModifiers(KModifier.ANNOTATION)
}

override fun builder(block: TypeSpecBuilderReceiver) = apply {
delegate.builder.block()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.toolisticon.kotlin.generation.builder

import com.squareup.kotlinpoet.ClassName
import com.squareup.kotlinpoet.KModifier
import com.squareup.kotlinpoet.TypeSpec
import io.toolisticon.kotlin.generation.BuilderSupplier
import io.toolisticon.kotlin.generation.poet.TypeSpecBuilder
Expand All @@ -24,6 +25,10 @@ class KotlinEnumClassSpecBuilder internal constructor(

}

init {
delegate.addModifiers(KModifier.ENUM)
}

// companion object :KLogging() {
// fun builder(className: ClassName) = KotlinEnumClassSpecBuilder(
// delegate = TypeSpecBuilder.enumBuilder(className)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ data class KotlinAnnotationClassSpec(
override fun get(): TypeSpec = spec

}
interface KotlinAnnotationClassSpecSupplier : KotlinGeneratorSpecSupplier<KotlinAnnotationClassSpec>, TypeSpecSupplier
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ data class KotlinAnnotationSpec(

}

interface KotlinAnnotationSpecSupplier : KotlinGeneratorSpecSupplier<KotlinAnnotationSpec>, AnnotationSpecSupplier

fun KotlinAnnotationSpec.toBuilder() = KotlinAnnotationSpecBuilder.from(spec = this)
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ data class KotlinAnonymousClassSpec(
override fun spec(): KotlinAnonymousClassSpec = this
override fun get(): TypeSpec = spec
}
interface KotlinAnonymousClassSpecSupplier : KotlinGeneratorSpecSupplier<KotlinAnonymousClassSpec>, TypeSpecSupplier
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ data class KotlinClassSpec(
//fun KotlinDataClassSpec.toFileSpec() = KotlinFileBuilder.builder(this).build()
// TODO fun KotlinDataClassSpec.toBuilder() = KotlinDataClassBuilder.from(spec = this)
// TODO fun KotlinDataClassSpec.toFileSpec() = KotlinFileSpecBuilder.builder(this).build()
interface KotlinClassSpecSupplier : KotlinGeneratorSpecSupplier<KotlinClassSpec>, TypeSpecSupplier
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ data class KotlinCompanionObjectSpec(
override fun spec(): KotlinCompanionObjectSpec = this
override fun get(): TypeSpec = spec
}
interface KotlinCompanionObjectSpecSupplier : KotlinGeneratorSpecSupplier<KotlinCompanionObjectSpec>, TypeSpecSupplier
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ data class KotlinConstructorPropertySpec(
val type: TypeName = property.type
override fun spec(): KotlinConstructorPropertySpec = this
}

interface KotlinConstructorPropertySpecSupplier : KotlinGeneratorSpecSupplier<KotlinConstructorPropertySpec>
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ data class KotlinDataClassSpec(
//fun KotlinDataClassSpec.toFileSpec() = KotlinFileBuilder.builder(this).build()
// TODO fun KotlinDataClassSpec.toBuilder() = KotlinDataClassBuilder.from(spec = this)
// TODO fun KotlinDataClassSpec.toFileSpec() = KotlinFileSpecBuilder.builder(this).build()
interface KotlinDataClassSpecSupplier : KotlinGeneratorSpecSupplier<KotlinDataClassSpec>, TypeSpecSupplier
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ data class KotlinEnumClassSpec(
override fun spec(): KotlinEnumClassSpec = this
override fun get(): TypeSpec = spec
}
interface KotlinEnumClassSpecSupplier : KotlinGeneratorSpecSupplier<KotlinEnumClassSpec>, TypeSpecSupplier
2 changes: 2 additions & 0 deletions kotlin-code-generation/src/main/kotlin/spec/KotlinFileSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ data class KotlinFileSpec(
override fun spec(): KotlinFileSpec = this
override fun get(): FileSpec = spec
}

interface KotlinFileSpecSupplier : KotlinGeneratorSpecSupplier<KotlinFileSpec>, FileSpecSupplier
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ data class KotlinFunSpec(
override fun spec(): KotlinFunSpec = this
override fun get(): FunSpec = spec
}
interface KotlinFunSpecSupplier : KotlinGeneratorSpecSupplier<KotlinFunSpec>, FunSpecSupplier
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ data class KotlinInterfaceSpec(
override fun spec(): KotlinInterfaceSpec = this
override fun get(): TypeSpec = spec
}
interface KotlinInterfaceSpecSupplier : KotlinGeneratorSpecSupplier<KotlinInterfaceSpec>, TypeSpecSupplier
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ data class KotlinObjectSpec(
override fun spec(): KotlinObjectSpec = this
override fun get(): TypeSpec = spec
}
interface KotlinObjectSpecSupplier : KotlinGeneratorSpecSupplier<KotlinObjectSpec>, TypeSpecSupplier
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ data class KotlinParameterSpec(
override fun get(): ParameterSpec = this.spec
}

interface KotlinParameterSpecSupplier : KotlinGeneratorSpecSupplier<KotlinParameterSpec>, ParameterSpecSupplier
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ data class KotlinPropertySpec(
}

// TODO fun KotlinPropertySpec.toBuilder() = KotlinPropertyBuilder.builder(spec = this)
interface KotlinPropertySpecSupplier : KotlinGeneratorSpecSupplier<KotlinPropertySpec>, PropertySpecSupplier
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ data class KotlinTypeAliasSpec(
override fun spec(): KotlinTypeAliasSpec = this
override fun get(): TypeAliasSpec = spec
}
interface KotlinTypeAliasSpecSupplier: KotlinGeneratorSpecSupplier<KotlinTypeAliasSpec>, TypeAliasSpecSupplier
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ data class KotlinValueClassSpec(
}

// fun KotlinValueClassSpec.toBuilder() = KotlinValueClassBuilder.builder(spec = this)
interface KotlinValueClassSpecSupplier : KotlinGeneratorSpecSupplier<KotlinValueClassSpec>, TypeSpecSupplier
22 changes: 4 additions & 18 deletions kotlin-code-generation/src/main/kotlin/spec/_types.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,7 @@ interface KotlinGeneratorTypeSpec<SELF : KotlinGeneratorTypeSpec<SELF>> : Kotlin
override fun spec(): SELF
}

interface KotlinAnnotationSpecSupplier : KotlinGeneratorSpecSupplier<KotlinAnnotationSpec>, AnnotationSpecSupplier
interface KotlinFileSpecSupplier : KotlinGeneratorSpecSupplier<KotlinFileSpec>, FileSpecSupplier
interface KotlinFunSpecSupplier : KotlinGeneratorSpecSupplier<KotlinFunSpec>, FunSpecSupplier
interface KotlinParameterSpecSupplier : KotlinGeneratorSpecSupplier<KotlinParameterSpec>, ParameterSpecSupplier
interface KotlinPropertySpecSupplier : KotlinGeneratorSpecSupplier<KotlinPropertySpec>, PropertySpecSupplier
interface KotlinTypeAliasSpecSupplier: KotlinGeneratorSpecSupplier<KotlinTypeAliasSpec>, TypeAliasSpecSupplier

interface KotlinAnnotationClassSpecSupplier : KotlinGeneratorSpecSupplier<KotlinAnnotationClassSpec>, TypeSpecSupplier
interface KotlinAnonymousClassSpecSupplier : KotlinGeneratorSpecSupplier<KotlinAnonymousClassSpec>, TypeSpecSupplier
interface KotlinClassSpecSupplier : KotlinGeneratorSpecSupplier<KotlinClassSpec>, TypeSpecSupplier
interface KotlinCompanionObjectSpecSupplier : KotlinGeneratorSpecSupplier<KotlinCompanionObjectSpec>, TypeSpecSupplier
interface KotlinDataClassSpecSupplier : KotlinGeneratorSpecSupplier<KotlinDataClassSpec>, TypeSpecSupplier
interface KotlinEnumClassSpecSupplier : KotlinGeneratorSpecSupplier<KotlinEnumClassSpec>, TypeSpecSupplier
interface KotlinInterfaceSpecSupplier : KotlinGeneratorSpecSupplier<KotlinInterfaceSpec>, TypeSpecSupplier
interface KotlinObjectSpecSupplier : KotlinGeneratorSpecSupplier<KotlinObjectSpec>, TypeSpecSupplier
interface KotlinValueClassSpecSupplier : KotlinGeneratorSpecSupplier<KotlinValueClassSpec>, TypeSpecSupplier

interface KotlinConstructorPropertySpecSupplier : KotlinGeneratorSpecSupplier<KotlinConstructorPropertySpec>




0 comments on commit f3d751d

Please sign in to comment.