TAPI topology creation for 100GE Transponder
[transportpce.git] / tapi / src / main / java / org / opendaylight / transportpce / tapi / utils / ServiceEndpointType.java
1 /*
2  * Copyright © 2018 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 package org.opendaylight.transportpce.tapi.utils;
9
10 import com.google.common.collect.ImmutableMap;
11
12 import java.util.Map;
13
14 /**
15  * Enum class to identify ServiceAEnd / serviceZEnd.
16  *
17  */
18 public enum ServiceEndpointType {
19     SERVICEAEND(1),
20     SERVICEZEND(2);
21
22     int value;
23     private static final Map<Integer, ServiceEndpointType> VALUE_MAP;
24
25     ServiceEndpointType(int value) {
26         this.value = value;
27     }
28
29     static {
30         final ImmutableMap.Builder<java.lang.Integer, ServiceEndpointType> builder =
31                 ImmutableMap.builder();
32         for (ServiceEndpointType enumItem : ServiceEndpointType.values()) {
33             builder.put(enumItem.value, enumItem);
34         }
35         VALUE_MAP = builder.build();
36     }
37
38     /**
39      * Get integer value.
40      *
41      * @return integer value.
42      */
43     public int getIntValue() {
44         return value;
45     }
46
47     /**
48      * Get Endpoint value.
49      *
50      * @param valueArg
51      *            Integer to identify Enum
52      * @return corresponding ServiceFormat item
53      */
54     public static ServiceEndpointType forValue(int valueArg) {
55         return VALUE_MAP.get(valueArg);
56     }
57
58 }