diff --git a/protocol/src/commonMain/kotlin/dev/arbjerg/lavalink/protocol/v4/loadResult.kt b/protocol/src/commonMain/kotlin/dev/arbjerg/lavalink/protocol/v4/loadResult.kt index a996e5ab4..f1b902d1f 100644 --- a/protocol/src/commonMain/kotlin/dev/arbjerg/lavalink/protocol/v4/loadResult.kt +++ b/protocol/src/commonMain/kotlin/dev/arbjerg/lavalink/protocol/v4/loadResult.kt @@ -136,7 +136,17 @@ data class Playlist( val pluginInfo: JsonObject, val tracks: List ) : LoadResult.Data { - fun deserialize(deserializer: DeserializationStrategy): T = pluginInfo.deserialize(deserializer) + + /** + * Deserialize the plugin info into a specific type. + * This method is a convenience method meant to be used in Java, + * since Kotlin extension methods are painful to use in Java. + * + * @param deserializer The deserializer to use. (e.g. `T.Companion.serializer()`) + * + * @return the deserialized plugin info as type T + */ + fun deserializePluginInfo(deserializer: DeserializationStrategy): T = pluginInfo.deserialize(deserializer) } @Serializable diff --git a/protocol/src/commonMain/kotlin/dev/arbjerg/lavalink/protocol/v4/player.kt b/protocol/src/commonMain/kotlin/dev/arbjerg/lavalink/protocol/v4/player.kt index 95bfdc4ef..f76d14c84 100644 --- a/protocol/src/commonMain/kotlin/dev/arbjerg/lavalink/protocol/v4/player.kt +++ b/protocol/src/commonMain/kotlin/dev/arbjerg/lavalink/protocol/v4/player.kt @@ -33,7 +33,17 @@ data class Track( val info: TrackInfo, val pluginInfo: JsonObject ) : LoadResult.Data { - fun deserialize(deserializer: DeserializationStrategy): T = pluginInfo.deserialize(deserializer) + + /** + * Deserialize the plugin info into a specific type. + * This method is a convenience method meant to be used in Java, + * since Kotlin extension methods are painful to use in Java. + * + * @param deserializer The deserializer to use. (e.g. `T.Companion.serializer()`) + * + * @return the deserialized plugin info as type T + */ + fun deserializePluginInfo(deserializer: DeserializationStrategy): T = pluginInfo.deserialize(deserializer) } @Serializable