Skip to content

Commit e4a52d7

Browse files
authored
Merge pull request #15 from linked-planet/feature/open_page
make Page an open class
2 parents aa766dd + 2b6ad24 commit e4a52d7

File tree

1 file changed

+30
-1
lines changed
  • kotlin-atlassian-client-core-common/src/main/kotlin/com/linkedplanet/kotlinatlassianclientcore/common/api

1 file changed

+30
-1
lines changed

kotlin-atlassian-client-core-common/src/main/kotlin/com/linkedplanet/kotlinatlassianclientcore/common/api/Page.kt

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,33 @@ data class Page<T> (
2727
@field:NotNull val totalPages: Int,
2828
@field:NotNull val currentPageIndex: Int,
2929
@field:NotNull val pageSize: Int
30-
)
30+
31+
32+
) {
33+
override fun equals(other: Any?): Boolean {
34+
if (this === other) return true
35+
if (other !is Page<*>) return false
36+
37+
if (items != other.items) return false
38+
if (totalItems != other.totalItems) return false
39+
if (totalPages != other.totalPages) return false
40+
if (currentPageIndex != other.currentPageIndex) return false
41+
if (pageSize != other.pageSize) return false
42+
43+
return true
44+
}
45+
46+
override fun hashCode(): Int {
47+
var result = items.hashCode()
48+
result = 31 * result + totalItems
49+
result = 31 * result + totalPages
50+
result = 31 * result + currentPageIndex
51+
result = 31 * result + pageSize
52+
return result
53+
}
54+
55+
override fun toString(): String {
56+
return "Page(items=$items, totalItems=$totalItems, totalPages=$totalPages, currentPageIndex=$currentPageIndex, pageSize=$pageSize)"
57+
}
58+
59+
}

0 commit comments

Comments
 (0)