Committed by
Gerrit Code Review
ProtectionType code fix
Change-Id: I08845f62af8af784eb56e3b1e09c00acc5dfd7de
Showing
1 changed file
with
20 additions
and
0 deletions
... | @@ -17,6 +17,8 @@ package org.onosproject.iptopology.api; | ... | @@ -17,6 +17,8 @@ package org.onosproject.iptopology.api; |
17 | 17 | ||
18 | import static com.google.common.base.MoreObjects.toStringHelper; | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
19 | 19 | ||
20 | +import java.util.HashMap; | ||
21 | +import java.util.Map; | ||
20 | import java.util.Objects; | 22 | import java.util.Objects; |
21 | 23 | ||
22 | /** | 24 | /** |
... | @@ -42,6 +44,24 @@ public class ProtectionType { | ... | @@ -42,6 +44,24 @@ public class ProtectionType { |
42 | value = val; | 44 | value = val; |
43 | } | 45 | } |
44 | 46 | ||
47 | + static Map<Integer, LinkProtectionType> map = new HashMap<>(); | ||
48 | + | ||
49 | + static { | ||
50 | + for (LinkProtectionType type : LinkProtectionType.values()) { | ||
51 | + map.put(type.value, type); | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * A method that returns enum value. | ||
57 | + * | ||
58 | + * @param value link protection type | ||
59 | + * @return Enum value | ||
60 | + */ | ||
61 | + public static LinkProtectionType getEnumType(int value) { | ||
62 | + return map.get(value); | ||
63 | + } | ||
64 | + | ||
45 | /** | 65 | /** |
46 | * Provides Link protection type. | 66 | * Provides Link protection type. |
47 | * | 67 | * | ... | ... |
-
Please register or login to post a comment