com.commercetools.rmf.diff.RamlDiff.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ctp-validators Show documentation
Show all versions of ctp-validators Show documentation
RAML API client code generators based on the REST Modeling Framework. https://github.com/vrapio/rest-modeling-framework
package com.commercetools.rmf.diff
import io.vrap.rmf.raml.model.modules.Api
class RamlDiff private constructor(original: Api, changed: Api, private val differs: List>) {
private val dataProvider = DataProvider(original, changed)
class Builder {
private var differs: List> = listOf()
private var original: Api? = null
private var changed: Api? = null
fun original(original: Api): Builder {
this.original = original
return this
}
fun changed(changed: Api): Builder {
this.changed = changed
return this
}
fun plus(differ: List>): Builder {
differs = differs.plus(differ)
return this
}
fun plus(differ: Differ<*>): Builder {
differs = differs.plus(differ as Differ)
return this
}
fun build(): RamlDiff {
return RamlDiff(original!!, changed!!, differs)
}
}
fun diff(): List> {
return differs.flatMap {
it.diff(dataProvider.by(it.diffDataType) as DiffData)
}
}
}