Initial opendaylight infrastructure commit!!
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-util / src / main / java / org / opendaylight / controller / model / util / Uint16.java
1 /*\r
2   * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
3   *\r
4   * This program and the accompanying materials are made available under the\r
5   * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6   * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7   */\r
8 package org.opendaylight.controller.model.util;\r
9 \r
10 import java.util.List;\r
11 \r
12 import org.opendaylight.controller.model.api.type.IntegerTypeDefinition;\r
13 import org.opendaylight.controller.model.api.type.RangeConstraint;\r
14 import org.opendaylight.controller.yang.common.QName;\r
15 \r
16 public class Uint16 extends AbstractInteger {\r
17 \r
18     private static final QName name = BaseTypes.constructQName("uint16");\r
19     private Integer defaultValue = null;\r
20     private static final String description = "";\r
21     private static final String reference = "";\r
22 \r
23     public Uint16() {\r
24         super(name, description, reference);\r
25     }\r
26 \r
27     public Uint16(final Integer defaultValue) {\r
28         super(name, description, reference);\r
29         this.defaultValue = defaultValue;\r
30     }\r
31 \r
32     public Uint16(final List<RangeConstraint> rangeStatements,\r
33             final Integer defaultValue) {\r
34         super(name, description, reference, rangeStatements);\r
35         this.defaultValue = defaultValue;\r
36     }\r
37 \r
38     public Uint16(final String units, final Integer defaultValue) {\r
39         super(name, description, reference, units);\r
40         this.defaultValue = defaultValue;\r
41     }\r
42 \r
43     /*\r
44      * (non-Javadoc)\r
45      * \r
46      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()\r
47      */\r
48     @Override\r
49     public IntegerTypeDefinition getBaseType() {\r
50         return this;\r
51     }\r
52 \r
53     /*\r
54      * (non-Javadoc)\r
55      * \r
56      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()\r
57      */\r
58     @Override\r
59     public Object getDefaultValue() {\r
60         return defaultValue;\r
61     }\r
62 \r
63     @Override\r
64     public int hashCode() {\r
65         final int prime = 31;\r
66         int result = super.hashCode();\r
67         result = prime * result\r
68                 + ((defaultValue == null) ? 0 : defaultValue.hashCode());\r
69         return result;\r
70     }\r
71 \r
72     @Override\r
73     public boolean equals(Object obj) {\r
74         if (this == obj) {\r
75             return true;\r
76         }\r
77         if (!super.equals(obj)) {\r
78             return false;\r
79         }\r
80         if (getClass() != obj.getClass()) {\r
81             return false;\r
82         }\r
83         Uint16 other = (Uint16) obj;\r
84         if (defaultValue == null) {\r
85             if (other.defaultValue != null) {\r
86                 return false;\r
87             }\r
88         } else if (!defaultValue.equals(other.defaultValue)) {\r
89             return false;\r
90         }\r
91         return true;\r
92     }\r
93 \r
94     @Override\r
95     public String toString() {\r
96         StringBuilder builder = new StringBuilder();\r
97         builder.append("Uint16 [defaultValue=");\r
98         builder.append(defaultValue);\r
99         builder.append(", AbstractInteger=");\r
100         builder.append(super.toString());\r
101         builder.append("]");\r
102         return builder.toString();\r
103     }\r
104 }\r