data class ContextMessage<V> : Any

A class for adding context messages to an object of type V.

Fields

Name Description
val value: V

actual object to be enriched by messages

val messages: List<String>

the actual list of messages to be added to the object

Constructors

<init>

constructor(value: V, message: String)

Parameters

Name Description
value: V
message: String

<init>

constructor(value: V, messages: List<String>)

A class for adding context messages to an object of type V.

Parameters

Name Description
value: V

actual object to be enriched by messages

messages: List<String>

the actual list of messages to be added to the object

Methods

isEmpty

fun isEmpty(): Boolean

ReturnValue

Name Description
Boolean

isNotEmpty

fun isNotEmpty(): messages.isNotEmpty()

ReturnValue

Name Description
messages.isNotEmpty()

Extensions

handleMessage

inline fun <V : Any> ContextMessage<V>.handleMessage(block: (List<String>)->Unit): V

Handle a message with block and then return only the ContextMessage.value.

Receiver

Name Description
ContextMessage<V>

ContextMessage to be handled

Parameters

Name Description
block: (List<String>)->Unit

the actual handler for the context message

ReturnValue

Name Description
V

only the remaining ContextMessage.value