From 07da07bb6da521f26845e744c5f093b426bd5259 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Thu, 29 Oct 2015 20:12:42 -0700 Subject: [PATCH] Doc. --- src/main/kotlin/com/beust/kobalt/maven/MavenId.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/beust/kobalt/maven/MavenId.kt b/src/main/kotlin/com/beust/kobalt/maven/MavenId.kt index 41216b21..35d05695 100644 --- a/src/main/kotlin/com/beust/kobalt/maven/MavenId.kt +++ b/src/main/kotlin/com/beust/kobalt/maven/MavenId.kt @@ -1,5 +1,15 @@ package com.beust.kobalt.maven +/** + * Encapsulate a Maven id captured in one string, as used by Gradle or Ivy, e.g. "org.testng:testng:6.9.9". + * These id's are somewhat painful to manipulate because on top of containing groupId, artifactId + * and version, they also accept an optional packaging (e.g. "aar") and qualifier (e.g. "no_aop"). + * Determining which is which in an untyped string separated by colons is not clearly defined so + * this class does a best attempt at deconstructing an id but there's surely room for improvement. + * + * This class accepts a versionless id, which needs to end with a :, e.g. "com.beust:jcommander:" (which + * usually means "latest version") but it doesn't handle version ranges yet. + */ public class MavenId(val id: String) { lateinit var groupId: String lateinit var artifactId: String @@ -33,7 +43,7 @@ public class MavenId(val id: String) { } } - private fun isVersion(s: String) : Boolean = Character.isDigit(s.get(0)) + private fun isVersion(s: String) : Boolean = Character.isDigit(s[0]) val hasVersion = version != null