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