Projekt

Obecné

Profil

Stáhnout (751 Bajtů) Statistiky
| Větev: | Tag: | Revize:
1
package cz.zcu.kiv.backendapi.user;
2

    
3
import lombok.Getter;
4

    
5
/**
6
 * Enum of permission with given name end byte value which is used to extract permission from number
7
 */
8
@Getter
9
public enum Permission {
10
    READ("READ", (byte) 0x1),
11
    WRITE("WRITE", (byte) 0x2),
12
    DELETE("DELETE", (byte) 0x4),
13

    
14
    ;
15

    
16
    /**
17
     * Permission name
18
     */
19
    private final String name;
20

    
21
    /**
22
     * Hexadecimal number containing only one bit set to 1 (corresponds to given permission)
23
     */
24
    private final byte bit;
25

    
26
    /**
27
     * Creates new permission with given name and byte value
28
     *
29
     * @param name name
30
     * @param bit  byte value
31
     */
32
    Permission(String name, byte bit) {
33
        this.name = name;
34
        this.bit = bit;
35
    }
36
}
(2-2/7)