core / pragma.content / ContentHandler /

ContentHandler #

abstract class ContentHandler<ContentProto : GeneratedMessageV3>(val contentDataClass: KClass<ContentProto>, logger: Logger = LoggerFactory.getLogger(ContentHandler::class.simpleName)) : ContentData<ContentProto>

ContentHandler is responsible for encapsulating a specific type of versioned content data.

Implements the ContentData interface.

Parameters #

contentDataClass

Identifies the content proto.

ContentProto

Generic type to enforce all values are of this proto.

Constructors #

ContentHandler

fun <ContentProto : GeneratedMessageV3> ContentHandler(contentDataClass: KClass<ContentProto>, logger: Logger = LoggerFactory.getLogger(ContentHandler::class.simpleName))

Functions #

NameSummary

getOrThrow

open override fun getOrThrow(id: String): ContentProto

Throws a PragmaException if missing a content entry for this id

idFromProto

abstract override fun idFromProto(proto: ContentProto): String

Assigns required string ID from proto.

migratePlayer

open suspend override fun migratePlayer(playerId: PlayerId, migratorFactory: MigratorFactory)

Called for live data migration.

tagsFromProto

open override fun tagsFromProto(proto: ContentProto): List<String>

Returns a list of strings expected to represent tags on a content proto.

validate

open fun validate(proto: ContentProto)

Part of validation steps - allows for any custom validation wanted for the ContentProto type.

validateExtWithAllContent

open override fun validateExtWithAllContent(contentByType: Map<String, ContentData<*>>)

Allows for custom validation of nested ext protos across all content types.

validateIds

open override fun validateIds(idsToValidate: Set<CorrespondingIds>, contentType: String)

Part of validation steps - checks that all IDs passed in are contained in this ContentData map.

validateWithAllContent

open override fun validateWithAllContent(contentByType: Map<String, ContentData<*>>)

Allows for custom validation across all content types.

Properties #

NameSummary

contentDataClass

private val contentDataClass: KClass<ContentProto>