Created
June 30, 2020 10:40
-
-
Save ferPrieto/614f2d1ed8b2b7b50746fc1a6021a3fa 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
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