MentaTutorials

Rev

Rev 16 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
16 soliveira 1
package org.menta.model;
2
 
3
public enum Group {
4
 
5
        GUEST(1), ADMIN(2), MASTER(3);
6
 
7
        private int code;
8
 
9
    private Group(int code) {
10
        this.code = code;
11
    }
12
 
13
    public int getCode() {
14
        return code;
15
    }
16
 
17
    public static Group fromCode(int code) {
18
        for(Group g : Group.values()) {
19
                if (g.getCode() == code) {
20
                        return g;
21
                }
22
        }
23
        return null;
24
    }
25
}