mvrx-mocking / com.airbnb.mvrx.mocking.printer / AutoValueTypePrinter / generateCode

generateCode

fun generateCode(instance: Any, generateConstructor: (Any?) -> String): String

Overrides TypePrinter.generateCode

A function that takes an instance of an object and returns a String representing the Kotlin code that can be used to recreate the instance with the same data.

Parameters

generateConstructor - This function can be used to access the default code generation for arbitrary object types. This can be used to generate code for any nested objects within the target instance. Note that calling this with instance will cause an infinite loop.