-
-
Save dilrajsingh1997/5fc2d96dcf85583f8b9f5b722866aa14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file addLine "fun getDestination(" | |
properties.forEach { property -> | |
val argumentName = property.simpleName.asString() | |
val resolvedType: KSType = property.type.resolve() | |
file addPhrase "$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 ", " | |
} | |
file addPhrase "): String {" | |
tabs ++ | |
file addLine "return \"$route${if (propertyCount > 0) "?" else ""}\" + " | |
tabs ++ | |
tabs ++ | |
count = 0 | |
properties.forEach { property -> | |
count ++ | |
val argumentName = property.simpleName.asString() | |
file addLine "\"$argumentName=" | |
file addPhrase "$$argumentName" | |
if (count == propertyCount) { | |
file addPhrase "\"" | |
} else { | |
file addPhrase ",\"" | |
} | |
file addPhrase " + " | |
} | |
file addLine "\"\"" | |
tabs -- | |
tabs -- | |
tabs -- | |
file addLine "}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment