import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.concepts.AbstractSimpleIdentifiable;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
+import org.opendaylight.yangtools.yang.model.repo.api.YangSchemaSourceRepresentation;
import org.opendaylight.yangtools.yang.parser.rfc7950.ir.IRKeyword.Unqualified;
@Beta
public final class IRSchemaSource extends AbstractSimpleIdentifiable<SourceIdentifier>
- implements SchemaSourceRepresentation {
+ implements YangSchemaSourceRepresentation {
private final @NonNull IRStatement rootStatement;
private final @Nullable String symbolicName;
* Implementations of this interface expected to comply with the {@link Immutable} contract.
*/
@Beta
-public interface SchemaSourceRepresentation extends Identifiable<SourceIdentifier>, Immutable {
+public sealed interface SchemaSourceRepresentation extends Identifiable<SourceIdentifier>, Immutable
+ permits YangSchemaSourceRepresentation, YinSchemaSourceRepresentation {
@Override
SourceIdentifier getIdentifier();
/**
* A YANG {@link SchemaSourceRepresentation}.
*/
-public interface YangSchemaSourceRepresentation extends SchemaSourceRepresentation {
+public non-sealed interface YangSchemaSourceRepresentation extends SchemaSourceRepresentation {
@Override
Class<? extends YangSchemaSourceRepresentation> getType();
}
}
@Override
- public Class<? extends YangTextSchemaSource> getType() {
+ public final Class<YangTextSchemaSource> getType() {
return YangTextSchemaSource.class;
}
public abstract DOMSource getSource();
@Override
- public final Class<? extends YinXmlSchemaSource> getType() {
+ public final Class<YinDomSchemaSource> getType() {
return YinDomSchemaSource.class;
}
/**
* A YIN {@link SchemaSourceRepresentation}.
*/
-public interface YinSchemaSourceRepresentation extends SchemaSourceRepresentation {
+public non-sealed interface YinSchemaSourceRepresentation extends SchemaSourceRepresentation {
@Override
Class<? extends YinSchemaSourceRepresentation> getType();
}
}
@Override
- public Class<? extends YinTextSchemaSource> getType() {
+ public final Class<YinTextSchemaSource> getType() {
return YinTextSchemaSource.class;
}
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
+import org.opendaylight.yangtools.yang.model.repo.api.YangSchemaSourceRepresentation;
@RunWith(MockitoJUnitRunner.StrictStubs.class)
public class PotentialSchemaSourceTest {
- private interface TestSchemaSourceRepresentation extends SchemaSourceRepresentation {
-
+ private interface TestSchemaSourceRepresentation extends YangSchemaSourceRepresentation {
+ @Override
+ default Class<TestSchemaSourceRepresentation> getType() {
+ return TestSchemaSourceRepresentation.class;
+ }
}
public final SourceIdentifier sourceIdentifier = new SourceIdentifier("foo");