Class MCPath

java.lang.Object
de.monticore.io.paths.MCPath

public final class MCPath extends Object
A ModelPath encapsulates the domain of accessible models inside the running language tool.
  • Field Details

  • Constructor Details

    • MCPath

      public MCPath()
    • MCPath

      public MCPath(Collection<Path> entries)
    • MCPath

      public MCPath(Path... entries)
    • MCPath

      public MCPath(String... entries)
  • Method Details

    • addEntry

      public void addEntry(Path entry)
    • removeEntry

      public void removeEntry(Path entry)
    • getEntries

      public Collection<Path> getEntries()
    • isEmpty

      public boolean isEmpty()
    • find

      public Optional<URL> find(String qualifiedName, String fileExtRegEx)
      Method for calculating a list of files located in an entry of the passed model path, with the passed qualified model name, and the passed regular expression over the file extension.

      Example: for a model path comprising two entries "src/test/resources" and "target", the qualified model name "foo.bar.Car", and the file extension regular expression "*sym", the result of this method could be a list with three files: "src/test/resources/foo/bar/Car.fdsym" "src/test/resources/foo/bar/Car.cdsym" "target/foo/bar/Car.fdsym"

      Parameters:
      fileExtRegEx -
      Returns:
    • find

      public Optional<URL> find(String path)
      Searches for a path in all entries. The result is either the fully qualified path or an empty Optional. An error is logged if multiple, ambiguous results are found.
      Parameters:
      path - a relative path, e.g, a/b/C.foo, to search in all MCPath entries
      Returns:
      the URL representing the unique fully qualified name of the result, if it exists
      Throws:
      AmbiguityException - if the search locates multiple potentially matching models
    • findResolvedUrls

      protected List<URL> findResolvedUrls(String fixedPath)
    • do_findResolvedUrls

      protected List<URL> do_findResolvedUrls(String fixedPath)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toPath

      public static Optional<Path> toPath(URL url)
    • toURL

      public static Optional<URL> toURL(Path p)
    • reportAmbiguity

      protected static void reportAmbiguity(List<URL> resolvedURLs, String path)
    • close

      public void close()
    • getJarFS

      public static FileSystem getJarFS(File jar)
    • closeAllJarFileSystems

      public static void closeAllJarFileSystems()
      Closes all still opened file systems created with getJarFS(File).