Skip to content

Instantly share code, notes, and snippets.

@dilrajsingh1997
Created November 20, 2021 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dilrajsingh1997/b42c2401c562021bbfe9bb1b0a47dcf2 to your computer and use it in GitHub Desktop.
Save dilrajsingh1997/b42c2401c562021bbfe9bb1b0a47dcf2 to your computer and use it in GitHub Desktop.
file addLine "data class $dataClassName ("
tabs++
properties.forEach { property ->
val argumentName = property.simpleName.asString()
val resolvedType: KSType = property.type.resolve()
file addLine "val $argumentName: "
file addPhrase (resolvedType.declaration.qualifiedName?.asString() ?: run {
logger.error("Invalid property type", property)
return
})
file addPhrase if (resolvedType.nullability == Nullability.NULLABLE) "?" else ""
file addPhrase ", "
}
tabs--
file addLine ")"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment