Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
fix: Standard object functions on class 'Id'
Browse files Browse the repository at this point in the history
Addressing Issue #1

Description:

The class Id does not implement the following functions

- toString
- hashCode
- equals

Fix:

Changed class 'Id' into a data class
with custom 'toString' implementation
  • Loading branch information
LSafer committed Jul 5, 2022
1 parent 507c3d2 commit 6f98c63
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/kotlin/Id.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,16 @@ fun <T> Id(value: Any): Id<T> {
* @since 1.0.0
*/
@Serializable(IdSerializer::class)
class Id<T>(
data class Id<T>(
/**
* The string representation of the id.
*
* @since 1.0.0
*/
val value: String
) : CharSequence by value
) : CharSequence by value {
override fun toString() = value
}

/**
* Return the best fitting native wrapper for
Expand Down

0 comments on commit 6f98c63

Please sign in to comment.