X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fconfig%2Fconfig-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fapi%2FJmxAttribute.java;fp=opendaylight%2Fconfig%2Fconfig-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fapi%2FJmxAttribute.java;h=96deb051ef91a1f1f4a3d629fc7984626ddf0dc9;hb=9fb64948564e252018f9b1e13e7cea2c92f991aa;hp=0000000000000000000000000000000000000000;hpb=1742b3894614be478c333a1043ced8ef1bc5dc84;p=controller.git diff --git a/opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/JmxAttribute.java b/opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/JmxAttribute.java new file mode 100644 index 0000000000..96deb051ef --- /dev/null +++ b/opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/JmxAttribute.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.config.api; + +/** + * Wrapper around strings to make {@link JmxAttributeValidationException} type + * safe. + */ +public class JmxAttribute { + private final String attributeName; + + public JmxAttribute(String attributeName) { + if (attributeName == null) + throw new NullPointerException("Parameter 'attributeName' is null"); + this.attributeName = attributeName; + } + + public String getAttributeName() { + return attributeName; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + JmxAttribute that = (JmxAttribute) o; + + if (attributeName != null ? !attributeName.equals(that.attributeName) + : that.attributeName != null) + return false; + + return true; + } + + @Override + public int hashCode() { + return attributeName != null ? attributeName.hashCode() : 0; + } + + @Override + public String toString() { + return "JmxAttribute{'" + attributeName + "'}"; + } +}