Fix checkstyle issues to enforce it
[controller.git] / opendaylight / config / config-api / src / main / java / org / opendaylight / controller / config / api / JmxAttribute.java
1 /*
2  * Copyright (c) 2013, 2017 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 package org.opendaylight.controller.config.api;
9
10 /**
11  * Wrapper around strings to make {@link JmxAttributeValidationException} type
12  * safe.
13  */
14 public class JmxAttribute {
15     private final String attributeName;
16
17     public JmxAttribute(final String attributeName) {
18         if (attributeName == null) {
19             throw new NullPointerException("Parameter 'attributeName' is null");
20         }
21         this.attributeName = attributeName;
22     }
23
24     /**
25      * Name of attribute in JMX.
26      */
27     public String getAttributeName() {
28         return attributeName;
29     }
30
31     @Override
32     public boolean equals(final Object object) {
33         if (this == object) {
34             return true;
35         }
36         if (object == null || getClass() != object.getClass()) {
37             return false;
38         }
39
40         JmxAttribute that = (JmxAttribute) object;
41
42         if (!attributeName.equals(that.attributeName)) {
43             return false;
44         }
45
46         return true;
47     }
48
49     @Override
50     public int hashCode() {
51         return attributeName.hashCode();
52     }
53
54     @Override
55     public String toString() {
56         return "JmxAttribute{'" + attributeName + "'}";
57     }
58 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.