Add reverse() method in Edge and Path classes
[controller.git] / opendaylight / config / config-api / src / main / java / org / opendaylight / controller / config / api / JmxAttribute.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 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(String attributeName) {
18         if (attributeName == null)
19             throw new NullPointerException("Parameter 'attributeName' is null");
20         this.attributeName = attributeName;
21     }
22
23     public String getAttributeName() {
24         return attributeName;
25     }
26
27     @Override
28     public boolean equals(Object o) {
29         if (this == o)
30             return true;
31         if (o == null || getClass() != o.getClass())
32             return false;
33
34         JmxAttribute that = (JmxAttribute) o;
35
36         if (attributeName != null ? !attributeName.equals(that.attributeName)
37                 : that.attributeName != null)
38             return false;
39
40         return true;
41     }
42
43     @Override
44     public int hashCode() {
45         return attributeName != null ? attributeName.hashCode() : 0;
46     }
47
48     @Override
49     public String toString() {
50         return "JmxAttribute{'" + attributeName + "'}";
51     }
52 }