Promote SchemaSourceRepresentation
[yangtools.git] / parser / yang-ir / src / main / java / org / opendaylight / yangtools / yang / ir / YangIRSchemaSource.java
similarity index 71%
rename from yang/yang-repo-api/src/main/java/org/opendaylight/yangtools/yang/model/repo/api/YangIRSchemaSource.java
rename to parser/yang-ir/src/main/java/org/opendaylight/yangtools/yang/ir/YangIRSchemaSource.java
index 690ff2de0058b9eb288e148a8ce439de473b007a..8a7fc490a2bb55d5d20a1b23f133f7a90f2e379e 100644 (file)
@@ -5,29 +5,25 @@
  * 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.ir;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static java.util.Objects.requireNonNull;
 
-import com.google.common.annotations.Beta;
-import java.util.Optional;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yangtools.concepts.AbstractSimpleIdentifiable;
-import org.opendaylight.yangtools.yang.ir.IRKeyword;
 import org.opendaylight.yangtools.yang.ir.IRKeyword.Unqualified;
-import org.opendaylight.yangtools.yang.ir.IRStatement;
+import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.source.YangSourceRepresentation;
 
-@Beta
-public final class YangIRSchemaSource extends AbstractSimpleIdentifiable<SourceIdentifier>
-        implements YangSchemaSourceRepresentation {
+public final class YangIRSchemaSource implements YangSourceRepresentation {
+    private final @NonNull SourceIdentifier sourceId;
     private final @NonNull IRStatement rootStatement;
     private final @Nullable String symbolicName;
 
-    public YangIRSchemaSource(final @NonNull SourceIdentifier identifier, final @NonNull IRStatement rootStatement,
+    public YangIRSchemaSource(final @NonNull SourceIdentifier sourceId, final @NonNull IRStatement rootStatement,
             final @Nullable String symbolicName) {
-        super(identifier);
+        this.sourceId = requireNonNull(sourceId);
         this.rootStatement = requireNonNull(rootStatement);
         this.symbolicName = symbolicName;
 
@@ -46,8 +42,13 @@ public final class YangIRSchemaSource extends AbstractSimpleIdentifiable<SourceI
     }
 
     @Override
-    public Optional<String> getSymbolicName() {
-        return Optional.ofNullable(symbolicName);
+    public SourceIdentifier sourceId() {
+        return sourceId;
+    }
+
+    @Override
+    public String symbolicName() {
+        return symbolicName;
     }
 
     @Override