1 package org.company.thesandbox.domain;
2
3 import java.util.EnumSet;
4 import java.util.HashMap;
5 import java.util.Map;
6
7
8
9
10
11
12 public enum Sexe {
13
14 FEMALE(2), MALE(3);
15
16 private static final Map<Integer, Sexe> lookup = new HashMap<Integer, Sexe>();
17 static {
18 for (Sexe s : EnumSet.allOf(Sexe.class))
19 lookup.put(s.id(), s);
20 }
21
22 private Integer id;
23
24 private Sexe(Integer id) {
25 this.id = id;
26 }
27
28 public Integer id() {
29 return id;
30 }
31
32 public static Sexe value(Integer id) {
33 return lookup.get(id);
34 }
35 }