Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
internal class InstagramTypeFactory : DefaultTypeFactory() {
override fun KParameter.createArgument(): Any? =
when (type.classifier) {
Int::class -> 0
Byte::class -> 0.toByte()
Short::class -> 0.toShort()
String::class -> ""
Float::class -> 0f
Long::class -> 0L
List::class -> emptyList<String>()
else -> if ((type.classifier as KClass<out Any>).findAnnotation<InstagramErrorCode>() != null) ErrorCode.TimeOut else null
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment