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 org.opendaylight.yangtools.yang.binding.BaseIdentity;
12 import java.beans.ConstructorProperties;
14 public final class IdentityAttributeRef {
16 public static final String QNAME_ATTR_NAME = "qNameOfIdentity";
18 private final String qNameOfIdentity;
20 @ConstructorProperties(QNAME_ATTR_NAME)
21 public IdentityAttributeRef(String qNameOfIdentity) {
22 if (qNameOfIdentity == null)
23 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(DependencyResolver resolver, Class<T> baseIdentity) {
32 return resolver.resolveIdentity(this, baseIdentity);
35 public <T extends BaseIdentity> void validateIdentity(DependencyResolver resolver, Class<T> baseIdentity, JmxAttribute jmxAttribute) {
36 resolver.validateIdentity(this, baseIdentity, jmxAttribute);
40 public String toString() {
41 final StringBuffer sb = new StringBuffer("IdentityAttributeRef{");
42 sb.append("qNameOfIdentity='").append(qNameOfIdentity).append('\'');
48 public boolean equals(Object o) {
49 if (this == o) return true;
50 if (!(o instanceof IdentityAttributeRef)) return false;
52 IdentityAttributeRef that = (IdentityAttributeRef) o;
54 if (!qNameOfIdentity.equals(that.qNameOfIdentity)) return false;
60 public int hashCode() {
61 return qNameOfIdentity.hashCode();