Skip to content

Commit

Permalink
chore: Align custom kotlinx-serializers to be objects
Browse files Browse the repository at this point in the history
Emphasize that there never will be multiple instances of these.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Oct 15, 2024
1 parent 4470675 commit 9607cd0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugins/package-managers/pub/src/main/kotlin/Pubspec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ internal data class Pubspec(
* If transformations like for JSON were available in kaml, this serializer could be simplified, see also
* https://github.com/charleskorn/kaml/issues/29.
*/
private class DependencyMapSerializer : KSerializer<Map<String, Dependency>> {
private object DependencyMapSerializer : KSerializer<Map<String, Dependency>> {
override val descriptor = serialDescriptor<Map<String, Dependency>>()

override fun serialize(encoder: Encoder, value: Map<String, Dependency>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ internal data class GitLabLicenseModel(
)
}

private class SortedDependenciesListSerializer :
private object SortedDependenciesListSerializer :
KSerializer<List<GitLabLicenseModel.Dependency>> by sortedListSerializer(
compareBy({ it.packageManager }, { it.name }, { it.version })
)

private class SortedLicenseSetSerializer :
private object SortedLicenseSetSerializer :
KSerializer<Set<GitLabLicenseModel.License>> by sortedSetSerializer(compareBy { it.id })

private class SortedStringSetSerializer : KSerializer<Set<String>> by sortedSetSerializer(compareBy { it })
private object SortedStringSetSerializer : KSerializer<Set<String>> by sortedSetSerializer(compareBy { it })

0 comments on commit 9607cd0

Please sign in to comment.