aboutsummaryrefslogtreecommitdiff
path: root/WordPress/src/main/java/org/wordpress/android/models/ReaderTagType.java
blob: 5075e81d35f9ea3ae7488d0ed4a9e5962e708a20 (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
45
package org.wordpress.android.models;

public enum ReaderTagType {
    FOLLOWED,
    DEFAULT,
    RECOMMENDED,
    CUSTOM_LIST,
    SEARCH;

    private static final int INT_DEFAULT     = 0;
    private static final int INT_FOLLOWED    = 1;
    private static final int INT_RECOMMENDED = 2;
    private static final int INT_CUSTOM_LIST = 3;
    private static final int INT_SEARCH      = 4;

    public static ReaderTagType fromInt(int value) {
        switch (value) {
            case INT_RECOMMENDED :
                return RECOMMENDED;
            case INT_FOLLOWED :
                return FOLLOWED;
            case INT_CUSTOM_LIST:
                return CUSTOM_LIST;
            case INT_SEARCH:
                return SEARCH;
            default :
                return DEFAULT;
        }
    }

    public int toInt() {
        switch (this) {
            case FOLLOWED:
                return INT_FOLLOWED;
            case RECOMMENDED:
                return INT_RECOMMENDED;
            case CUSTOM_LIST:
                return INT_CUSTOM_LIST;
            case SEARCH:
                return INT_SEARCH;
            default :
                return INT_DEFAULT;
        }
    }
}