com.faendir.kotlin.autodsl.parameter.Parameter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of processor Show documentation
Show all versions of processor Show documentation
Auto-generates DSL for your Kotlin projects using annotations.
The newest version!
package com.faendir.kotlin.autodsl.parameter
import com.squareup.kotlinpoet.TypeName
class Parameter(
val typeName: TypeName,
val name: String,
val doc: String?,
val hasDefault: Boolean,
requiredGroup: String?,
val index: Int,
val hasNestedDsl: Boolean,
val collectionType: CollectionType?
) {
val isMandatory = requiredGroup != null || !hasDefault && !typeName.isNullable
val group = requiredGroup ?: (name + index)
}
sealed class CollectionType(val createFunction: String, val convertFunction: String, val singular: String) {
class ListType(singular: String) : CollectionType("listOf", "toList", singular)
class SetType(singular: String) : CollectionType("setOf", "toSet", singular)
}