Committed by
Gerrit Code Review
Route Type
Change-Id: I02ece9267da7d79c049383b6b48aae42a181cfbc
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 | /** |
| ... | @@ -41,6 +43,24 @@ public class RouteType { | ... | @@ -41,6 +43,24 @@ public class RouteType { |
| 41 | value = val; | 43 | value = val; |
| 42 | } | 44 | } |
| 43 | 45 | ||
| 46 | + static Map<Integer, Type> map = new HashMap<>(); | ||
| 47 | + | ||
| 48 | + static { | ||
| 49 | + for (Type type : Type.values()) { | ||
| 50 | + map.put(type.value, type); | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * A method that returns enum value. | ||
| 56 | + * | ||
| 57 | + * @param value route type | ||
| 58 | + * @return Enum value | ||
| 59 | + */ | ||
| 60 | + public static Type getEnumType(int value) { | ||
| 61 | + return map.get(value); | ||
| 62 | + } | ||
| 63 | + | ||
| 44 | /** | 64 | /** |
| 45 | * Provides route type. | 65 | * Provides route type. |
| 46 | * | 66 | * | ... | ... |
-
Please register or login to post a comment