Make sure invokeOperation is set once
[controller.git] / opendaylight / adsal / 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.XmlAccessType;
12 import javax.xml.bind.annotation.XmlAccessorType;
13 import javax.xml.bind.annotation.XmlElement;
14 import javax.xml.bind.annotation.XmlRootElement;
15
16 /**
17  * The class represents Admin Config status
18  *
19  *
20  */
21 @XmlRootElement
22 @SuppressWarnings("serial")
23 @XmlAccessorType(XmlAccessType.NONE)
24 @Deprecated
25 public class Config extends Property {
26     @XmlElement(name="value")
27     private short configValue;
28
29     public static final short ADMIN_DOWN = 0;
30     public static final short ADMIN_UP = 1;
31     public static final short ADMIN_UNDEF = 0x7fff;
32     public static final String ConfigPropName = "config";
33
34     /*
35      * Private constructor used for JAXB mapping
36      */
37     private Config() {
38         super(ConfigPropName);
39         this.configValue = ADMIN_UNDEF;
40     }
41
42     public Config(short config) {
43         super(ConfigPropName);
44         this.configValue = config;
45     }
46
47     @Override
48     public Config clone() {
49         return new Config(this.configValue);
50     }
51
52     public short getValue() {
53         return this.configValue;
54     }
55
56     @Override
57     public int hashCode() {
58         final int prime = 31;
59         int result = super.hashCode();
60         result = prime * result + configValue;
61         return result;
62     }
63
64     @Override
65     public boolean equals(Object obj) {
66         if (this == obj)
67             return true;
68         if (!super.equals(obj))
69             return false;
70         if (getClass() != obj.getClass())
71             return false;
72         Config other = (Config) obj;
73         if (configValue != other.configValue)
74             return false;
75         return true;
76     }
77
78     @Override
79     public String toString() {
80         return "Config["+ configValue +"]";
81     }
82
83     @Override
84     public String getStringValue() {
85         if (configValue == 0) {
86             return "ADMIN_DOWN";
87         } else if (configValue == 1) {
88             return "ADMIN_UP";
89         } else if (configValue == 0x7fff) {
90             return "ADMIN_UNDEF";
91         } else {
92             return String.valueOf(configValue);
93         }
94     }
95 }