oday
05/08/2023, 4:38 PMJoffrey
05/08/2023, 4:40 PMThumbnailFeedItem
? Is it another class within the sealed class?oday
05/08/2023, 4:41 PMinterface ThumbnailFeedItem {
val id: String
val imageUrl: String?
val title: String
val subtitle: String?
val apiType: String
}
christophsturm
05/08/2023, 4:42 PMchristophsturm
05/08/2023, 4:42 PMJoffrey
05/08/2023, 4:46 PMopen
constructor properties of FeedItem
into abstract properties instead, so there is less repetitions in super-constructor calls for the subtype declarations.
Second is I would either remove the FeedItem
suffix from the nested classes, or unnest those classes:
sealed class FeedItem : Serializable {
abstract val id: String
abstract val title: String
abstract val status: FeedItemStatus
/** The GraphQL type (needed for analytics tracking) */
abstract val apiType: String
data class ThumbnailWithUrl(
override val id: String,
override val status: FeedItemStatus,
override val title: String,
override val subtitle: String?,
val url: String,
override val imageUrl: String,
override val apiType: String
) : FeedItem(), ThumbnailFeedItem
data class Blog(
override val id: String,
override val status: FeedItemStatus,
override val title: String,
override val subtitle: String?,
val eventTitle: String?,
val eventSubtitle: String?,
val eventImage: String?,
val actionText: String?,
val actionUrl: String?,
override val imageUrl: String,
val authorName: String,
val contentHtml: String,
val createdAt: OffsetDateTime,
val items: List<CollectionItem>,
override val apiType: String
) : FeedItem(), Serializable, ThumbnailFeedItem
}
Joffrey
05/08/2023, 4:47 PMsealed interface FeedItem : Serializable {
val id: String
val title: String
val status: FeedItemStatus
/** The GraphQL type (needed for analytics tracking) */
val apiType: String
data class ThumbnailWithUrl(
override val id: String,
override val status: FeedItemStatus,
override val title: String,
override val subtitle: String?,
val url: String,
override val imageUrl: String,
override val apiType: String
) : FeedItem, ThumbnailFeedItem
data class Blog(
override val id: String,
override val status: FeedItemStatus,
override val title: String,
override val subtitle: String?,
val eventTitle: String?,
val eventSubtitle: String?,
val eventImage: String?,
val actionText: String?,
val actionUrl: String?,
override val imageUrl: String,
val authorName: String,
val contentHtml: String,
val createdAt: OffsetDateTime,
val items: List<CollectionItem>,
override val apiType: String
) : FeedItem, Serializable, ThumbnailFeedItem
}
oday
05/08/2023, 4:51 PModay
05/08/2023, 4:53 PMchristophsturm
05/08/2023, 4:54 PModay
05/08/2023, 4:55 PMJoffrey
05/08/2023, 4:56 PMBlog
.Joffrey
05/08/2023, 4:56 PMjava.io.Serializable
?oday
05/08/2023, 4:56 PMchristophsturm
05/08/2023, 4:56 PMJoffrey
05/08/2023, 4:57 PMjava.io.Serializable
interface is very likely not what you want. Are you using Java binary serialization anywhere here?christophsturm
05/08/2023, 4:57 PMchristophsturm
05/08/2023, 4:58 PModay
05/08/2023, 4:58 PMchristophsturm
05/08/2023, 5:01 PMColton Idle
05/08/2023, 7:11 PModay
05/08/2023, 7:13 PM