Skip to content

Commit

Permalink
rename deserialize to deserializePluginInfo & docs
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed Oct 12, 2023
1 parent 62d03df commit 83128ee
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,17 @@ data class Playlist(
val pluginInfo: JsonObject,
val tracks: List<Track>
) : LoadResult.Data {
fun <T> deserialize(deserializer: DeserializationStrategy<T>): 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 <T> deserializePluginInfo(deserializer: DeserializationStrategy<T>): T = pluginInfo.deserialize(deserializer)
}

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ data class Track(
val info: TrackInfo,
val pluginInfo: JsonObject
) : LoadResult.Data {
fun <T> deserialize(deserializer: DeserializationStrategy<T>): 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 <T> deserializePluginInfo(deserializer: DeserializationStrategy<T>): T = pluginInfo.deserialize(deserializer)
}

@Serializable
Expand Down

0 comments on commit 83128ee

Please sign in to comment.