-
-
Save dilrajsingh1997/c49dba13a18091e38e79a50fc516493f 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
fun getParsedElement() { | |
when (propertyInfo.composeArgumentType) { | |
ComposeArgumentType.BOOLEAN -> file addPhrase "backStackEntry.arguments?.getBoolean(\"$argumentName\") ?: false" | |
ComposeArgumentType.STRING -> file addPhrase "backStackEntry.arguments?.getString(\"$argumentName\") ?: \"\"" | |
ComposeArgumentType.FLOAT -> file addPhrase "backStackEntry.arguments?.getFloat(\"$argumentName\") ?: 0F" | |
ComposeArgumentType.INT -> file addPhrase "backStackEntry.arguments?.getInt(\"$argumentName\") ?: 0" | |
ComposeArgumentType.LONG -> file addPhrase "backStackEntry.arguments?.getLong(\"$argumentName\") ?: 0L" | |
ComposeArgumentType.INT_ARRAY -> file addPhrase "backStackEntry.arguments?.getIntArray(\"$argumentName\") ?: intArrayOf()" | |
ComposeArgumentType.BOOLEAN_ARRAY -> file addPhrase "backStackEntry.arguments?.getBooleanArray(\"$argumentName\") ?: booleanArrayOf()" | |
ComposeArgumentType.LONG_ARRAY -> file addPhrase "backStackEntry.arguments?.getLongArray(\"$argumentName\") ?: longArrayOf()" | |
ComposeArgumentType.FLOAT_ARRAY -> file addPhrase "backStackEntry.arguments?.getFloatArray(\"$argumentName\") ?: floatArrayOf()" | |
ComposeArgumentType.PARCELABLE -> { | |
file addPhrase "backStackEntry.arguments?.getParcelable<" | |
addVariableType(file, propertyInfo) | |
file addPhrase ">(\"$argumentName\") ?: throw NullPointerException(\"parcel value not found\")" | |
} | |
ComposeArgumentType.PARCELABLE_ARRAY -> { | |
file addPhrase "backStackEntry.arguments?.getParcelableArrayList" | |
visitChildTypeArguments(propertyInfo.typeArguments) | |
file addPhrase "(\"$argumentName\")" | |
file addPhrase " ?: throw NullPointerException(\"parcel value not found\")" | |
} | |
ComposeArgumentType.SERIALIZABLE -> { | |
file addPhrase "backStackEntry.arguments?.getSerializable" | |
file addPhrase "(\"$argumentName\") as? " | |
addVariableType(file, propertyInfo) | |
file addPhrase " ?: throw NullPointerException(\"parcel value not found\")" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment