Record Class CanonicalPackageUri

java.lang.Object
java.lang.Record
org.pkl.core.project.CanonicalPackageUri

public record CanonicalPackageUri(URI baseUri, int majorVersion) extends Record
The canonical name of a package dependency within a project.

Equivalent to the package's base URI, and the major version number, i.e. package://example.com/foo/bar@0. Does not include a URI's userinfo, query params or fragment segments.

  • Constructor Details

    • CanonicalPackageUri

      public CanonicalPackageUri(URI baseUri, int majorVersion)
      Creates an instance of a CanonicalPackageUri record class.
      Parameters:
      baseUri - the value for the baseUri record component
      majorVersion - the value for the majorVersion record component
  • Method Details

    • fromPackageUri

      public static CanonicalPackageUri fromPackageUri(PackageUri packageUri)
    • of

      public static CanonicalPackageUri of(String uriStr) throws URISyntaxException
      Throws:
      URISyntaxException
    • getMajorVersion

      @Deprecated(forRemoval=true) public int getMajorVersion()
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of 0.28.0, replaced by majorVersion().
    • getBaseUri

      @Deprecated(forRemoval=true) public URI getBaseUri()
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of 0.28.0, replaced by baseUri().
    • equals

      public 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • toString

      public 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
    • baseUri

      public URI baseUri()
      Returns the value of the baseUri record component.
      Returns:
      the value of the baseUri record component
    • majorVersion

      public int majorVersion()
      Returns the value of the majorVersion record component.
      Returns:
      the value of the majorVersion record component