All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.kevcodez.pubg.model.telemetry.objects.Item.kt Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package de.kevcodez.pubg.model.telemetry.objects

import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.JsonNode
import de.kevcodez.pubg.model.telemetry.enums.Category
import de.kevcodez.pubg.model.telemetry.enums.SubCategory

@JsonIgnoreProperties(ignoreUnknown = true)
data class Item(
    val itemId: String,
    val stackCount: Int,
    var itemCategory: Category? = null,
    var itemSubCategory: SubCategory?,
    val attachedItems: List
) {
    @JsonProperty("category")
    private fun unpackCategory(category: JsonNode) {
        val categoryAsString = category.textValue()

        itemCategory = if (categoryAsString.isNullOrBlank()) null else Category.valueOf(categoryAsString)
    }

    @JsonProperty("subCategory")
    private fun unpackSubCategory(category: JsonNode) {
        val categoryAsString = category.textValue()

        itemSubCategory = if (categoryAsString.isNullOrBlank()) null else SubCategory.valueOf(categoryAsString)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy