Bump upstreams
[netconf.git] / plugins / netconf-client-mdsal / src / main / java / org / opendaylight / netconf / client / mdsal / CachedYangTextSchemaSource.java
index 1e222233d03ca8d8db8985eae30e7b7ce4ebf04f..76b9c7e8729f6b9f6fd1ff4353eb2d7a1c849210 100644 (file)
@@ -12,39 +12,46 @@ import static java.util.Objects.requireNonNull;
 import com.google.common.base.MoreObjects;
 import java.io.Reader;
 import java.io.StringReader;
-import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceId;
-import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
-import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
+import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.source.YangTextSource;
 
 /**
- * A {@link YangTextSchemaSource} cached from a remote service.
+ * A {@link YangTextSource} cached from a remote service.
  */
-public final class CachedYangTextSchemaSource extends YangTextSchemaSource {
-    private final RemoteDeviceId id;
-    private final String schemaString;
-    private final String symbolicName;
+// FIXME: subclass StringYangTextSource and cleanup addToStringAttributes()
+public final class CachedYangTextSchemaSource extends YangTextSource {
+    private final @NonNull SourceIdentifier sourceId;
+    private final @NonNull RemoteDeviceId id;
+    private final @NonNull String symbolicName;
+    private final @NonNull String schemaString;
 
-    public CachedYangTextSchemaSource(final RemoteDeviceId id, final SourceIdentifier sourceIdentifier,
+    public CachedYangTextSchemaSource(final RemoteDeviceId id, final SourceIdentifier sourceId,
             final String symbolicName, final String schemaString) {
-        super(sourceIdentifier);
-        this.symbolicName = requireNonNull(symbolicName);
         this.id = requireNonNull(id);
+        this.sourceId = requireNonNull(sourceId);
+        this.symbolicName = requireNonNull(symbolicName);
         this.schemaString = requireNonNull(schemaString);
     }
 
     @Override
-    protected MoreObjects.ToStringHelper addToStringAttributes(final MoreObjects.ToStringHelper toStringHelper) {
-        return toStringHelper.add("device", id);
+    public Reader openStream() {
+        return new StringReader(schemaString);
     }
 
     @Override
-    public Reader openStream() {
-        return new StringReader(schemaString);
+    public SourceIdentifier sourceId() {
+        return sourceId;
+    }
+
+    @Override
+    public String symbolicName() {
+        return symbolicName;
     }
 
     @Override
-    public Optional<String> getSymbolicName() {
-        return Optional.of(symbolicName);
+    protected MoreObjects.ToStringHelper addToStringAttributes(final MoreObjects.ToStringHelper toStringHelper) {
+        return toStringHelper.add("device", id);
     }
 }
\ No newline at end of file