Fix Jdk8 compatibility
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / md / util / OpenflowVersion.java
1 package org.opendaylight.openflowplugin.api.openflow.md.util;
2
3 /** List of Openflow versions supported by the plugin
4  *  Note: If you add a version here, make sure to update org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil as well.
5  * Created by kramesha on 5/2/14.
6  */
7 public enum OpenflowVersion {
8
9     OF10((short)0x01),
10     OF13((short)0x04),
11     UNSUPPORTED((short)0x00);
12
13
14     private short version;
15
16     OpenflowVersion(short version) {
17         this.version = version;
18     }
19
20     public static OpenflowVersion get(Short version) {
21         for (OpenflowVersion ofv : OpenflowVersion.values()) {
22             if (ofv.version == version) {
23                 return ofv;
24             }
25         }
26         return UNSUPPORTED;
27     }
28     
29     /**
30      * @return the version
31      */
32     public short getVersion() {
33         return version;
34     }
35
36 }