Creating value objects

Similar to what we did when creating the messenger backend, we need to create value objects to model common types of data we will be handling across the application. Create a vo package in the data package. The value objects we are creating are already familiar to you. In fact, they are exactly the same as those we created during the development of the API. We are going to create ConversationListVO, ConversationVO, UserListVO, UserVO, and MessageVO. Create Kotlin files to hold each of these value objects in the vo package. Before creating any list value object data models, we have to create the basic models. These models are UserVO, MessageVO, and ConversationVO.

Create a UserVO data class, as follows:

package com.example.messenger.data.vo ...

Get Kotlin Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.