Do not subclass YangTextSchemaSource in yang-repo-fs
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / repo / api / YangTextSchemaSource.java
index 0e521561aa6927ae7c8225e215a7903da39b961a..d21fdcb021aecd36399355f7fda36ec470e7b07d 100644 (file)
@@ -78,11 +78,24 @@ public abstract class YangTextSchemaSource extends ByteSource implements YangSch
      * @param file Backing File
      * @return A new YangTextSchemaSource
      * @throws IllegalArgumentException if the file name has invalid format or if the supplied File is not a file
-     * @throws NullPointerException if file is null
+     * @throws NullPointerException if file is {@code null}
      */
     public static @NonNull YangTextSchemaSource forFile(final File file) {
+        return forFile(file, identifierFromFilename(file.getName()));
+    }
+
+    /**
+     * Create a new YangTextSchemaSource backed by a {@link File} and specified {@link SourceIdentifier}.
+     *
+     * @param file Backing File
+     * @param identifier source identifier
+     * @return A new YangTextSchemaSource
+     * @throws IllegalArgumentException if the file name has invalid format or if the supplied File is not a file
+     * @throws NullPointerException if any argument is {@code null}
+     */
+    public static @NonNull YangTextSchemaSource forFile(final File file, final SourceIdentifier identifier) {
         checkArgument(file.isFile(), "Supplied file %s is not a file", file);
-        return new YangTextFileSchemaSource(identifierFromFilename(file.getName()), file);
+        return new YangTextFileSchemaSource(identifier, file);
     }
 
     /**