
de.kevcodez.pubg.model.telemetry.objects.Item.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pubg-api-wrapper Show documentation
Show all versions of pubg-api-wrapper Show documentation
Teaching how to use gradle.
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