When True
Conditional field: only present on the wire when the referenced expression is true. The field must be nullable with a default value of null.
@ProtocolMessage
data class OptionalPayload(
val hasExtra: Boolean,
@WhenTrue("hasExtra") val extra: Int? = null, // only read/written when hasExtra == true
)Content copied to clipboard
Dotted expressions access properties on value class fields:
@WhenTrue("flags.willFlag") val willTopic: String? = nullContent copied to clipboard
Parameters
expression
"fieldName" for a Boolean field, or "fieldName.property" for a property on a value class field.