Remove yang-test
[controller.git] / opendaylight / config / config-api / src / main / java / org / opendaylight / controller / config / api / IdentityAttributeRef.java
1 /*
2  * Copyright (c) 2013, 2017 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 import java.beans.ConstructorProperties;
11 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
12
13 public final class IdentityAttributeRef {
14
15     public static final String QNAME_ATTR_NAME = "qNameOfIdentity";
16
17     private final String qualifiedNameOfIdentity;
18
19     @ConstructorProperties(QNAME_ATTR_NAME)
20     public IdentityAttributeRef(final String qualifiedNameOfIdentity) {
21         if (qualifiedNameOfIdentity == null) {
22             throw new NullPointerException("Parameter " + QNAME_ATTR_NAME + " is null");
23         }
24         this.qualifiedNameOfIdentity = qualifiedNameOfIdentity;
25     }
26
27     public String getqNameOfIdentity() {
28         return qualifiedNameOfIdentity;
29     }
30
31     public <T extends BaseIdentity> Class<? extends T> resolveIdentity(final DependencyResolver resolver,
32             final Class<T> baseIdentity) {
33         return resolver.resolveIdentity(this, baseIdentity);
34     }
35
36     public <T extends BaseIdentity> void validateIdentity(final DependencyResolver resolver,
37             final Class<T> baseIdentity, final JmxAttribute jmxAttribute) {
38         resolver.validateIdentity(this, baseIdentity, jmxAttribute);
39     }
40
41     @Override
42     public String toString() {
43         return "IdentityAttributeRef{" + "qualifiedNameOfIdentity='" + qualifiedNameOfIdentity + "'}";
44     }
45
46     @Override
47     public boolean equals(final Object object) {
48         if (this == object) {
49             return true;
50         }
51         if (!(object instanceof IdentityAttributeRef)) {
52             return false;
53         }
54
55         IdentityAttributeRef that = (IdentityAttributeRef) object;
56
57         if (!qualifiedNameOfIdentity.equals(that.qualifiedNameOfIdentity)) {
58             return false;
59         }
60
61         return true;
62     }
63
64     @Override
65     public int hashCode() {
66         return qualifiedNameOfIdentity.hashCode();
67     }
68 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.