Record Class MavenCoordinate

java.lang.Object
java.lang.Record
network.ike.workspace.cascade.MavenCoordinate
Record Components:
groupId - the Maven groupId; non-null and non-blank
artifactId - the Maven artifactId; non-null and non-blank
All Implemented Interfaces:
Comparable<MavenCoordinate>

public record MavenCoordinate(String groupId, String artifactId) extends Record implements Comparable<MavenCoordinate>
A Maven groupId:artifactId coordinate — the canonical value type for "which artifact" across the cascade model.

Replaces the long-standing (String groupId, String artifactId) idiom that the cascade code carried since the YAML-manifest era. Treating the pair as a record gives the compiler what convention could not: argument-order checking (resolve(artifactId, groupId) no longer silently compiles), single-parameter signatures wherever a coordinate was passed, and a free Object.equals(Object) / Object.hashCode() so Map<MavenCoordinate, ...> replaces the ad-hoc "groupId:artifactId" string keys the assembler used to build by hand.

Coordinates produce three derived strings that recur in the cascade model:

  • ga() — the "groupId:artifactId" display form, used in log lines and as a parse/format target for human input.
  • versionProperty() — the canonical IKE version-property name <groupId>__GA__<artifactId>__VERSION (typed-marker family, IKE-Network/ike-issues#525). Used by the alignment path to locate the property that pins this coordinate.
  • versionPropertyLegacy() — the pre-#525 form <groupId>·<artifactId> (U+00B7 MIDDLE DOT). Kept for transition-period read fallback; callers should look up the typed-marker form first, then fall back to the legacy form.
  • policyProperty() / policyPropertyLegacy() — the release-policy property names in the new and legacy conventions respectively.
  • toString() — equal to ga(), for direct use in error messages and string concatenation.
  • Constructor Details

    • MavenCoordinate

      public MavenCoordinate(String groupId, String artifactId)
      Canonical constructor — validates that both components are non-null and non-blank.
  • Method Details

    • of

      public static MavenCoordinate of(String groupId, String artifactId)
      Builds a coordinate or throws. Sugar for MavenCoordinate(String, String).
      Parameters:
      groupId - the Maven groupId
      artifactId - the Maven artifactId
      Returns:
      the coordinate
    • tryOf

      public static Optional<MavenCoordinate> tryOf(String groupId, String artifactId)
      Builds a coordinate, or returns empty when either component is null or blank. The lenient companion to of(String, String), useful when scanning Maven models whose <plugin> or <dependency> entries may legitimately omit <groupId> (the Maven default plugin group, for instance) — the deriver does not want to throw on these, it wants to skip them.
      Parameters:
      groupId - the Maven groupId; may be null or blank
      artifactId - the Maven artifactId; may be null or blank
      Returns:
      the coordinate, or empty when either component is missing
    • parse

      public static MavenCoordinate parse(String ga)
      Parses a "groupId:artifactId" string into a coordinate. Splits on the first colon, matching the Maven display convention.
      Parameters:
      ga - the G:A string
      Returns:
      the coordinate
      Throws:
      IllegalArgumentException - if ga contains no colon or has an empty component
    • ga

      public String ga()
      Returns the "groupId:artifactId" display form.
      Returns:
      the G:A string
    • versionProperty

      public String versionProperty()
      Returns the canonical IKE version-property name in the typed-marker family form: <groupId>__GA__<artifactId>__VERSION. The alignment path uses this to locate the property that pins this coordinate (IKE-Network/ike-issues#525). Callers operating during the transition period should fall back to versionPropertyLegacy() when this name resolves to no value — both forms may appear in real POMs while the foundation cascade rolls forward.
      Returns:
      the canonical typed-marker property name
    • versionPropertyLegacy

      public String versionPropertyLegacy()
      Returns the legacy IKE version-property name — <groupId>·<artifactId> (U+00B7 MIDDLE DOT) — used by the pre-#525 convention. Kept for transition-period read fallback: callers should try versionProperty() first, then fall back to this. Removed once the foundation cascade has fully migrated to the typed-marker family.
      Returns:
      the legacy property name
    • policyProperty

      public String policyProperty()
      Returns the canonical IKE release-policy property name in the typed-marker family form: <groupId>__GA__<artifactId>__POLICY. Value is a ReleasePolicy rung.
      Returns:
      the canonical typed-marker policy property name
    • policyPropertyLegacy

      public String policyPropertyLegacy()
      Returns the legacy IKE release-policy property name — <groupId>·<artifactId>·policy — used by the pre-#525 convention. Kept for transition-period read fallback.
      Returns:
      the legacy policy property name
    • toString

      public String toString()
      Returns ga().
      Specified by:
      toString in class Record
      Returns:
      the G:A string
    • compareTo

      public int compareTo(MavenCoordinate other)
      Natural ordering: by groupId first, then by artifactId. Lets TreeMap / TreeSet use coordinates directly and produces deterministic cascade orderings.
      Specified by:
      compareTo in interface Comparable<MavenCoordinate>
      Parameters:
      other - the coordinate to compare against
      Returns:
      negative / zero / positive per the standard contract
    • 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.
    • groupId

      public String groupId()
      Returns the value of the groupId record component.
      Returns:
      the value of the groupId record component
    • artifactId

      public String artifactId()
      Returns the value of the artifactId record component.
      Returns:
      the value of the artifactId record component