Checkstyle: fix issues and enforce on lisp-proto
[lispflowmapping.git] / mappingservice / lisp-proto / src / main / java / org / opendaylight / lispflowmapping / lisp / type / LispCanonicalAddressFormatEnum.java
1 /*
2  * Copyright (c) 2014 Contextream, 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.lispflowmapping.lisp.type;
10
11 /**
12  * The LCAF enum. http://tools.ietf.org/html/draft-ietf-lisp-lcaf-03
13  */
14 public enum LispCanonicalAddressFormatEnum {
15     LIST(1), //
16     SEGMENT(2), //
17     APPLICATION_DATA(4), //
18     SOURCE_DEST(12), //
19     TRAFFIC_ENGINEERING(10), //
20     KEY_VALUE(15), //
21     SERVICE_PATH(17),
22     UNKNOWN(-1);
23
24     private byte lispCode;
25
26     LispCanonicalAddressFormatEnum(int lispCode) {
27         this.lispCode = (byte) lispCode;
28     }
29
30     public byte getLispCode() {
31         return lispCode;
32     }
33
34     public static LispCanonicalAddressFormatEnum valueOf(int lispCode) {
35         for (LispCanonicalAddressFormatEnum val : values()) {
36             if (val.getLispCode() == lispCode) {
37                 return val;
38             }
39         }
40         return UNKNOWN;
41     }
42 }