Merge "Trigger a GC once initial configuration has been pushed"
[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         }
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(Object o) {
33         if (this == o) {
34             return true;
35         }
36         if (o == null || getClass() != o.getClass()) {
37             return false;
38         }
39
40         JmxAttribute that = (JmxAttribute) o;
41
42         if (attributeName != null ? !attributeName.equals(that.attributeName)
43                 : that.attributeName != null) {
44             return false;
45         }
46
47         return true;
48     }
49
50     @Override
51     public int hashCode() {
52         return attributeName != null ? attributeName.hashCode() : 0;
53     }
54
55     @Override
56     public String toString() {
57         return "JmxAttribute{'" + attributeName + "'}";
58     }
59 }