Two more Equals/HashCode/StringBuilder replacements
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / core / AdvertisedBandwidth.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.sal.core;
11
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  * @file   AdvertisedBandWidth.java
19  *
20  * @brief  Class representing advertised bandwidth
21  *
22  * Describes Advertised Bandwidth which could be of a link or whatever could have
23  * bandwidth as description. It's intended in multiple of bits per
24  * seconds.
25  */
26 @XmlRootElement
27 @SuppressWarnings("serial")
28 public class AdvertisedBandwidth extends Bandwidth {
29         public static final String AdvertisedBandwidthPropName = "advertisedBandwidth";
30         
31         public AdvertisedBandwidth(long value) {
32                 super(AdvertisedBandwidthPropName);
33                 this.bandwidthValue = value;
34         }
35         
36         /*
37      * Private constructor used for JAXB mapping
38      */
39     private AdvertisedBandwidth() {
40         super(AdvertisedBandwidthPropName);
41                 this.bandwidthValue = 0;
42     }
43         
44         public AdvertisedBandwidth clone() {
45                 return new AdvertisedBandwidth(this.bandwidthValue);  
46     }
47         
48     @Override
49     public int hashCode() {
50         return HashCodeBuilder.reflectionHashCode(this);
51     }
52
53     @Override
54     public boolean equals(Object obj) {
55         return EqualsBuilder.reflectionEquals(this, obj);
56     }   
57     
58     @Override
59     public String toString() {
60         StringBuffer sb = new StringBuffer();
61         sb.append("AdvertisedBandWidth[");
62         sb.append(super.toString());
63         sb.append("]");
64         return sb.toString();
65     }
66
67 }