PinnedSiteAdapter.kt 964 Bytes
Newer Older
1
2
3
4
5
6
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package mozilla.components.feature.top.sites.adapter

7
import mozilla.components.feature.top.sites.PinnedSite
8
import mozilla.components.feature.top.sites.db.PinnedSiteEntity
9

10
internal class PinnedSiteAdapter(
11
    internal val entity: PinnedSiteEntity
12
) : PinnedSite {
13
14
15
16
17
18
19
20
21
    override val id: Long
        get() = entity.id!!

    override val title: String
        get() = entity.title

    override val url: String
        get() = entity.url

22
23
24
    override val isDefault: Boolean
        get() = entity.isDefault

25
    override fun equals(other: Any?): Boolean {
26
        if (other !is PinnedSiteAdapter) {
27
28
29
30
31
32
33
34
35
36
            return false
        }

        return entity == other.entity
    }

    override fun hashCode(): Int {
        return entity.hashCode()
    }
}