Checkstyle enforcer
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / core / Config.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, 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.controller.sal.core;
10
11 import javax.xml.bind.annotation.XmlElement;
12 import javax.xml.bind.annotation.XmlRootElement;
13
14 /**
15  * The class represents Admin Config status
16  *
17  *
18  */
19 @XmlRootElement
20 @SuppressWarnings("serial")
21 public class Config extends Property {
22     @XmlElement
23     private short configValue;
24
25     public static final short ADMIN_DOWN = 0;
26     public static final short ADMIN_UP = 1;
27     public static final short ADMIN_UNDEF = 0x7fff;
28     public static final String ConfigPropName = "config";
29
30     /*
31      * Private constructor used for JAXB mapping
32      */
33     private Config() {
34         super(ConfigPropName);
35         this.configValue = ADMIN_UNDEF;
36     }
37
38     public Config(short config) {
39         super(ConfigPropName);
40         this.configValue = config;
41     }
42
43     public Config clone() {
44         return new Config(this.configValue);
45     }
46
47     public short getValue() {
48         return this.configValue;
49     }
50
51     @Override
52     public int hashCode() {
53         final int prime = 31;
54         int result = super.hashCode();
55         result = prime * result + configValue;
56         return result;
57     }
58
59     @Override
60     public boolean equals(Object obj) {
61         if (this == obj)
62             return true;
63         if (!super.equals(obj))
64             return false;
65         if (getClass() != obj.getClass())
66             return false;
67         Config other = (Config) obj;
68         if (configValue != other.configValue)
69             return false;
70         return true;
71     }
72
73     @Override
74     public String toString() {
75         return "Config["+ configValue +"]";
76     }
77 }