Package org.pkl.core

Record Class ImportGraph

java.lang.Object
java.lang.Record
org.pkl.core.ImportGraph
Record Components:
imports - The graph of imports declared within the program.

Each key is a module inside the program, and each value is the module URIs declared as imports inside that module. The set of all dependent modules within a program is the set of keys in this map.

resolvedImports - A mapping of a module's in-language URI, and the URI that it resolves to.

For example, a local package dependency is represented with scheme projectpackage:, and (typically) resolves to a file: scheme.


public record ImportGraph(Map<URI,Set<ImportGraph.Import>> imports, Map<URI,URI> resolvedImports) extends Record
Java representation of pkl.analyze#ImportGraph.
  • Constructor Details

    • ImportGraph

      public ImportGraph(Map<URI,Set<ImportGraph.Import>> imports, Map<URI,URI> resolvedImports)
      Creates an instance of a ImportGraph record class.
      Parameters:
      imports - the value for the imports record component
      resolvedImports - the value for the resolvedImports record component
  • Method Details

    • parseFromJson

      public static ImportGraph parseFromJson(String input) throws Json.JsonParseException
      Parses the provided JSON into an import graph.
      Throws:
      Json.JsonParseException
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • imports

      public Map<URI,Set<ImportGraph.Import>> imports()
      Returns the value of the imports record component.
      Returns:
      the value of the imports record component
    • resolvedImports

      public Map<URI,URI> resolvedImports()
      Returns the value of the resolvedImports record component.
      Returns:
      the value of the resolvedImports record component