2 * Copyright (c) 2022 PANTHEON.tech, s.r.o. 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.yangtools.yang.binding;
10 import com.google.common.base.MoreObjects;
11 import org.eclipse.jdt.annotation.NonNullByDefault;
12 import org.eclipse.jdt.annotation.Nullable;
13 import org.opendaylight.yangtools.yang.common.QName;
16 * Abstract base class for classes generated for YANG {@code feature} statements.
19 public abstract non-sealed class YangFeature<F extends YangFeature<F, R>, R extends DataRoot>
20 implements BindingContract<F> {
22 public abstract Class<F> implementedInterface();
25 * Return the {@link QName} associated with this feature.
29 public abstract QName qname();
32 * Return the {@code module} which defines this feature.
34 * @return A module's {@link DataRoot} class
36 public abstract Class<R> definingModule();
39 public final int hashCode() {
40 return implementedInterface().hashCode();
44 public final boolean equals(final @Nullable Object obj) {
45 return obj == this || obj instanceof YangFeature<?, ?> other
46 && implementedInterface().equals(other.implementedInterface());
50 public final String toString() {
51 return MoreObjects.toStringHelper(this).add("qname", qname()).toString();