<groupId>org.opendaylight.mdsal.model</groupId>
<artifactId>yang-ext</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.kohsuke.metainf-services</groupId>
+ <artifactId>metainf-services</artifactId>
+ </dependency>
</dependencies>
</project>
--- /dev/null
+/*
+ * Copyright (c) 2022 PANTHEON.tech, s.r.o. 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.mdsal.binding.test.model.util;
+
+import java.util.Set;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.kohsuke.MetaInfServices;
+import org.opendaylight.yang.gen.v1.mdsal767.norev.Mdsal767Data;
+import org.opendaylight.yang.gen.v1.mdsal767.norev.One$F;
+import org.opendaylight.yangtools.yang.binding.YangFeature;
+import org.opendaylight.yangtools.yang.binding.YangFeatureProvider;
+
+@MetaInfServices
+@NonNullByDefault
+public final class Mdsal767Support implements YangFeatureProvider<Mdsal767Data> {
+ @Override
+ public Class<Mdsal767Data> boundModule() {
+ return Mdsal767Data.class;
+ }
+
+ @Override
+ public Set<? extends YangFeature<?, Mdsal767Data>> supportedFeatures() {
+ return Set.of(One$F.VALUE);
+ }
+}
--- /dev/null
+module mdsal767 {
+ namespace mdsal767;
+ prefix mdsal767;
+
+ feature one;
+
+ feature two;
+
+ container one {
+ if-feature one;
+ }
+
+ container two {
+ if-feature two;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2022 PANTHEON.tech, s.r.o. 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.yangtools.yang.binding;
+
+import java.util.ServiceLoader;
+import java.util.Set;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Run-time feature discovery service. Implementations of this interface are required to be registered with the
+ * {@link ServiceLoader} framework.
+ */
+@NonNullByDefault
+public interface YangFeatureProvider<R extends DataRoot> {
+ /**
+ * Return the module this provider recognizes. It is implied that any feature defined in this module and not
+ * advertized by any provider is unavailable.
+ *
+ * @return {@link DataRoot} class this provider binds to
+ */
+ Class<R> boundModule();
+
+ /**
+ * Return the set of supported features.
+ *
+ * @return Supported features.
+ */
+ Set<? extends YangFeature<?, R>> supportedFeatures();
+}