Initial commit for ServiceHandler
[transportpce.git] / servicehandler / src / main / java / org / opendaylight / transportpce / servicehandler / MyEndpoint.java
1 /*
2  * Copyright © 2017 Orange, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.transportpce.servicehandler;
10
11 import java.util.Map;
12
13 /*
14  * Enum class to identify ServiceAEnd / serviceZEnd.
15  *
16  * @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
17  *
18  */
19 enum MyEndpoint {
20     SERVICEAEND(1),
21     SERVICEZEND(2);
22
23     int value;
24     private static final Map<Integer, MyEndpoint> VALUE_MAP;
25
26     MyEndpoint(int value) {
27         this.value = value;
28     }
29
30     static {
31         final com.google.common.collect.ImmutableMap.Builder<java.lang.Integer, MyEndpoint> b =
32                 com.google.common.collect.ImmutableMap.builder();
33         for (MyEndpoint enumItem : MyEndpoint.values()) {
34             b.put(enumItem.value, enumItem);
35         }
36
37         VALUE_MAP = b.build();
38     }
39
40     /*
41      * Get integer value.
42      *
43      * @return integer value.
44      */
45     public int getIntValue() {
46         return value;
47     }
48
49     /*
50      * Get Endpoint value.
51      *
52      * @param valueArg
53      *            Integer to identify Enum
54      * @return corresponding ServiceFormat item
55      */
56     public static MyEndpoint forValue(int valueArg) {
57         return VALUE_MAP.get(valueArg);
58     }
59 }