Promote SchemaSourceRepresentation
[yangtools.git] / model / yang-model-spi / src / main / java / org / opendaylight / yangtools / yang / model / spi / source / YangTextFileSource.java
similarity index 75%
rename from yang/yang-repo-api/src/main/java/org/opendaylight/yangtools/yang/model/repo/api/YangTextFileSchemaSource.java
rename to model/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/source/YangTextFileSource.java
index c17d96bd9269610b85286edc6e4e40e53ffd8414..06890023dda1770619359fe0351b689841360dc4 100644 (file)
@@ -5,7 +5,7 @@
  * 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.model.repo.api;
+package org.opendaylight.yangtools.yang.model.spi.source;
 
 import static java.util.Objects.requireNonNull;
 
@@ -16,21 +16,19 @@ import java.io.Reader;
 import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.util.Optional;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.Delegator;
+import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
 
 /**
- * A {@link YangTextSchemaSource} backed by a file.
- *
- * @author Robert Varga
+ * A {@link YangTextSource} backed by a file.
  */
-final class YangTextFileSchemaSource extends YangTextSchemaSource implements Delegator<Path> {
+final class YangTextFileSource extends YangTextSource implements Delegator<Path> {
     private final @NonNull Path path;
     private final @NonNull Charset charset;
 
-    YangTextFileSchemaSource(final SourceIdentifier identifier, final Path path, final Charset charset) {
-        super(identifier);
+    YangTextFileSource(final SourceIdentifier sourceId, final Path path, final Charset charset) {
+        super(sourceId);
         this.path = requireNonNull(path);
         this.charset = requireNonNull(charset);
     }
@@ -51,9 +49,9 @@ final class YangTextFileSchemaSource extends YangTextSchemaSource implements Del
     }
 
     @Override
-    public Optional<String> getSymbolicName() {
+    public String symbolicName() {
         // FIXME: NEXT: this is forcing internal normalization. I think this boils down to providing Path back, which
         //        is essentially getDelegate() anyway. Perhaps expose it as PathAware?
-        return Optional.of(path.toString());
+        return path.toString();
     }
 }