Record Class MavenCoordinate
java.lang.Object
java.lang.Record
network.ike.workspace.cascade.MavenCoordinate
- Record Components:
groupId- the MavengroupId; non-null and non-blankartifactId- the MavenartifactId; 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 toga(), for direct use in error messages and string concatenation.
-
Constructor Summary
ConstructorsConstructorDescriptionMavenCoordinate(String groupId, String artifactId) Canonical constructor — validates that both components are non-null and non-blank. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theartifactIdrecord component.intcompareTo(MavenCoordinate other) Natural ordering: bygroupIdfirst, then byartifactId.final booleanIndicates whether some other object is "equal to" this one.ga()Returns the"groupId:artifactId"display form.groupId()Returns the value of thegroupIdrecord component.final inthashCode()Returns a hash code value for this object.static MavenCoordinateBuilds a coordinate or throws.static MavenCoordinateParses a"groupId:artifactId"string into a coordinate.Returns the canonical IKE release-policy property name in the typed-marker family form:<groupId>__GA__<artifactId>__POLICY.Returns the legacy IKE release-policy property name —<groupId>·<artifactId>·policy— used by the pre-#525 convention.toString()Returnsga().static Optional<MavenCoordinate> Builds a coordinate, or returns empty when either component is null or blank.Returns the canonical IKE version-property name in the typed-marker family form:<groupId>__GA__<artifactId>__VERSION.Returns the legacy IKE version-property name —<groupId>·<artifactId>(U+00B7 MIDDLE DOT) — used by the pre-#525 convention.
-
Constructor Details
-
MavenCoordinate
-
-
Method Details
-
of
Builds a coordinate or throws. Sugar forMavenCoordinate(String, String).- Parameters:
groupId- the MavengroupIdartifactId- the MavenartifactId- Returns:
- the coordinate
-
tryOf
Builds a coordinate, or returns empty when either component is null or blank. The lenient companion toof(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 MavengroupId; may benullor blankartifactId- the MavenartifactId; may benullor blank- Returns:
- the coordinate, or empty when either component is missing
-
parse
Parses a"groupId:artifactId"string into a coordinate. Splits on the first colon, matching the Maven display convention.- Parameters:
ga- theG:Astring- Returns:
- the coordinate
- Throws:
IllegalArgumentException- ifgacontains no colon or has an empty component
-
ga
-
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 toversionPropertyLegacy()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
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 tryversionProperty()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
Returns the canonical IKE release-policy property name in the typed-marker family form:<groupId>__GA__<artifactId>__POLICY. Value is aReleasePolicyrung.- Returns:
- the canonical typed-marker policy property name
-
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
-
compareTo
Natural ordering: bygroupIdfirst, then byartifactId. LetsTreeMap/TreeSetuse coordinates directly and produces deterministic cascade orderings.- Specified by:
compareToin interfaceComparable<MavenCoordinate>- Parameters:
other- the coordinate to compare against- Returns:
- negative / zero / positive per the standard contract
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
groupId
-
artifactId
Returns the value of theartifactIdrecord component.- Returns:
- the value of the
artifactIdrecord component
-