1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

Code clean up.

This commit is contained in:
Cedric Beust 2015-10-08 23:04:53 -07:00
parent 763be25864
commit f066b6d99e

View file

@ -12,8 +12,8 @@ import kotlin.dom.childElements
public class Pom @javax.inject.Inject constructor(@Assisted val id: String, public class Pom @javax.inject.Inject constructor(@Assisted val id: String,
@Assisted documentFile: java.io.File) : KobaltLogger { @Assisted documentFile: java.io.File) : KobaltLogger {
val XPATH_FACTORY = javax.xml.xpath.XPathFactory.newInstance(); val XPATH_FACTORY = javax.xml.xpath.XPathFactory.newInstance()
val XPATH = XPATH_FACTORY.newXPath(); val XPATH = XPATH_FACTORY.newXPath()
var groupId: String? = null var groupId: String? = null
var artifactId: String? = null var artifactId: String? = null
var version: String? = null var version: String? = null
@ -70,22 +70,22 @@ public class Pom @javax.inject.Inject constructor(@Assisted val id: String,
} }
val deps = DEPENDENCIES.evaluate(document, XPathConstants.NODESET) as NodeList val deps = DEPENDENCIES.evaluate(document, XPathConstants.NODESET) as NodeList
for (i in 0..deps.getLength() - 1) { for (i in 0..deps.length - 1) {
val d = deps.item(i) as NodeList val d = deps.item(i) as NodeList
var groupId: String? = null var groupId: String? = null
var artifactId: String? = null var artifactId: String? = null
var version: String = "" var version: String = ""
var optional: Boolean? = false var optional: Boolean? = false
var scope: String? = null var scope: String? = null
for (j in 0..d.getLength() - 1) { for (j in 0..d.length - 1) {
val e = d.item(j) val e = d.item(j)
if (e is Element) { if (e is Element) {
when (e.getTagName()) { when (e.tagName) {
"groupId" -> groupId = e.getTextContent () "groupId" -> groupId = e.textContent
"artifactId" -> artifactId = e.getTextContent() "artifactId" -> artifactId = e.textContent
"version" -> version = e.getTextContent() "version" -> version = e.textContent
"optional" -> optional = "true".equals(e.getTextContent(), true) "optional" -> optional = "true".equals(e.textContent, true)
"scope" -> scope = e.getTextContent() "scope" -> scope = e.textContent
} }
} }
} }