Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Permission.java « model « deck « nextcloud « niedermann « it « java « main « src « app - github.com/stefan-niedermann/nextcloud-deck.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 73c5644ed42fc5feea6c4ebf627530899be63c9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package it.niedermann.nextcloud.deck.model;

import androidx.room.Entity;
import androidx.room.PrimaryKey;

import it.niedermann.nextcloud.deck.model.enums.PermissionType;

@Entity(inheritSuperIndices = true)
public class Permission {
    @PrimaryKey(autoGenerate = true)
    private long id;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public PermissionType getType() {
        return PermissionType.findById(id);
    }

    public void setType(PermissionType type) {
        this.id = type.getId();
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Permission that = (Permission) o;

        return id == that.id;
    }

    @Override
    public int hashCode() {
        return (int) (id ^ (id >>> 32));
    }
}