f7b3ee85dbacfc31a41d133a4820c46151738916
[ovsdb.git] / ovsdb / src / main / java / org / opendaylight / ovsdb / lib / database / OvsdbType.java
1 /*
2  * [[ Authors will Fill in the Copyright header ]]
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  * Authors : Brent Salisbury, Evan Zeller
9  */
10 package org.opendaylight.ovsdb.lib.database;\r
11 \r
12 import com.fasterxml.jackson.annotation.JsonProperty;
13 \r
14 \r
15 public class OvsdbType {\r
16     public enum PortType {\r
17         VLAN("vlan"),\r
18         TUNNEL("Tunnel"),\r
19         BONDING("Bonding"),\r
20         PATCH("patch"),\r
21         INTERNAL("internal");\r
22 \r
23         private PortType(String name) {\r
24             this.name = name;\r
25         }\r
26 \r
27         private String name;\r
28 \r
29         @Override
30         public String toString() {\r
31             return name;\r
32         }\r
33     }\r
34     public OvsdbType(String type){\r
35         this.key = new BaseType(type);\r
36     }\r
37 \r
38     public OvsdbType(@JsonProperty("key") BaseType key, @JsonProperty("value") BaseType value,\r
39             @JsonProperty("min") Integer min, @JsonProperty("max") Object max){\r
40         this.key = key;\r
41         this.value = value;\r
42         this.min = min;\r
43         this.max = max;\r
44     }\r
45 \r
46     public BaseType key;\r
47     public BaseType value;\r
48     public Integer min;\r
49     public Object max;\r
50 \r
51     public static class BaseType{\r
52 \r
53         public BaseType(String type){\r
54             this.type = type;\r
55         }\r
56 \r
57         public BaseType(@JsonProperty("type") String type, @JsonProperty("enum") Object ovsdbEnum,\r
58                 @JsonProperty("minInteger") Integer minInteger, @JsonProperty("maxInteger") Integer maxInteger,\r
59                 @JsonProperty("minReal") Double minReal, @JsonProperty("maxReal") Double maxReal,\r
60                 @JsonProperty("minLength") Integer minLength, @JsonProperty("maxLength") Integer maxLength,\r
61                 @JsonProperty("refTable") String refTable, @JsonProperty("refType") String refType){\r
62             this.type = type;\r
63             this.ovsdbEnum = ovsdbEnum;\r
64             this.minInteger = minInteger;\r
65             this.maxInteger = maxInteger;\r
66             this.minReal = minReal;\r
67             this.maxReal = maxReal;\r
68             this.minLength = minLength;\r
69             this.maxLength = maxLength;\r
70             this.refTable = refTable;\r
71             this.refType = refType;\r
72         }\r
73 \r
74         public String type;\r
75         public Object ovsdbEnum;\r
76         public Integer minInteger;\r
77         public Integer maxInteger;\r
78         public Double minReal;\r
79         public Double maxReal;\r
80         public Integer minLength;\r
81         public Integer maxLength;\r
82         public String refTable;\r
83         public String refType;\r
84         @Override\r
85         public String toString() {\r
86             return "BaseType [type=" + type + ", ovsdbEnum="\r
87                     + ovsdbEnum + ", minInteger=" + minInteger\r
88                     + ", maxInteger=" + maxInteger + ", minReal=" + minReal\r
89                     + ", maxReal=" + maxReal + ", minLength=" + minLength\r
90                     + ", maxLength=" + maxLength + ", refTable=" + refTable\r
91                     + ", refType=" + refType + "]";\r
92         }\r
93     }\r
94 \r
95     @Override\r
96     public String toString() {\r
97         return "OvsdbType [key=" + key + ", value=" + value + ", min=" + min\r
98                 + ", max=" + max + "]";\r
99     }\r
100 }\r