Change to update node properties
[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 import org.apache.commons.lang3.builder.EqualsBuilder;
15 import org.apache.commons.lang3.builder.HashCodeBuilder;
16
17 /**
18  * The class represents Admin Config status
19  * 
20  * 
21  */
22 @XmlRootElement
23 @SuppressWarnings("serial")
24 public class Config extends Property {
25     @XmlElement
26     private short configValue;
27
28     public static final short ADMIN_DOWN = 0;
29     public static final short ADMIN_UP = 1;
30     public static final short ADMIN_UNDEF = 0x7fff;
31     public static final String ConfigPropName = "config";
32
33     /*
34      * Private constructor used for JAXB mapping
35      */
36     private Config() {
37         super(ConfigPropName);
38         this.configValue = ADMIN_UNDEF;
39     }
40
41     public Config(short config) {
42         super(ConfigPropName);
43         this.configValue = config;
44     }
45
46     public Config clone() {
47         return new Config(this.configValue);
48     }
49
50     public short getValue() {
51         return this.configValue;
52     }
53
54     @Override
55     public int hashCode() {
56         return HashCodeBuilder.reflectionHashCode(this);
57     }
58
59     @Override
60     public boolean equals(Object obj) {
61         return EqualsBuilder.reflectionEquals(this, obj);
62     }
63
64     @Override
65     public String toString() {
66         return "Config["+ configValue +"]";
67     }
68 }