2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.config.api;
10 import java.beans.ConstructorProperties;
11 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
13 public final class IdentityAttributeRef {
15 public static final String QNAME_ATTR_NAME = "qNameOfIdentity";
17 private final String qNameOfIdentity;
19 @ConstructorProperties(QNAME_ATTR_NAME)
20 public IdentityAttributeRef(final String qNameOfIdentity) {
21 if (qNameOfIdentity == null) {
22 throw new NullPointerException("Parameter " + QNAME_ATTR_NAME + " is null");
24 this.qNameOfIdentity = qNameOfIdentity;
27 public String getqNameOfIdentity() {
28 return qNameOfIdentity;
31 public <T extends BaseIdentity> Class<? extends T> resolveIdentity(final DependencyResolver resolver, final Class<T> baseIdentity) {
32 return resolver.resolveIdentity(this, baseIdentity);
35 public <T extends BaseIdentity> void validateIdentity(final DependencyResolver resolver, final Class<T> baseIdentity, final JmxAttribute jmxAttribute) {
36 resolver.validateIdentity(this, baseIdentity, jmxAttribute);
40 public String toString() {
41 final StringBuilder sb = new StringBuilder("IdentityAttributeRef{");
42 sb.append("qNameOfIdentity='").append(qNameOfIdentity).append('\'');
48 public boolean equals(final Object o) {
52 if (!(o instanceof IdentityAttributeRef)) {
56 IdentityAttributeRef that = (IdentityAttributeRef) o;
58 if (!qNameOfIdentity.equals(that.qNameOfIdentity)) {
66 public int hashCode() {
67 return qNameOfIdentity.hashCode();