Skip to content

Commit

Permalink
chore: Use Convenience Api to resolve KClass
Browse files Browse the repository at this point in the history
  • Loading branch information
wba2hi committed Mar 22, 2024
1 parent a02f9e6 commit deb3b95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import org.eclipse.kuksa.vssprocessor.parser.KEY_DATA_UUID
import org.eclipse.kuksa.vssprocessor.parser.ROOT_KEY_VEHICLE
import org.eclipse.kuksa.vssprocessor.parser.VSS_DATA_KEYS
import org.eclipse.kuksa.vssprocessor.parser.VssParser
import org.eclipse.kuksa.vssprocessor.spec.VssDataType
import org.eclipse.kuksa.vssprocessor.spec.VssNodePropertiesBuilder
import org.eclipse.kuksa.vssprocessor.spec.VssNodeSpecModel
import java.io.File
Expand Down Expand Up @@ -107,16 +106,13 @@ internal class JsonVssParser : VssParser {
val min = jsonObject.get(KEY_DATA_MIN)?.asString ?: ""
val max = jsonObject.get(KEY_DATA_MAX)?.asString ?: ""

val vssDataType = VssDataType.find(datatype)
val valueDataType = vssDataType.valueDataType

val vssNodeProperties = VssNodePropertiesBuilder(uuid, type)
.withDescription(description)
.withComment(comment)
.withDataType(datatype)
.withUnit(unit)
.withMin(min, valueDataType)
.withMax(max, valueDataType)
.withMin(min, datatype)
.withMax(max, datatype)
.build()

return VssNodeSpecModel(vssPath, vssNodeProperties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import org.eclipse.kuksa.vssprocessor.parser.KEY_DATA_TYPE
import org.eclipse.kuksa.vssprocessor.parser.KEY_DATA_UNIT
import org.eclipse.kuksa.vssprocessor.parser.KEY_DATA_UUID
import org.eclipse.kuksa.vssprocessor.parser.VssParser
import org.eclipse.kuksa.vssprocessor.spec.VssDataType
import org.eclipse.kuksa.vssprocessor.spec.VssNodePropertiesBuilder
import org.eclipse.kuksa.vssprocessor.spec.VssNodeSpecModel
import java.io.File
Expand Down Expand Up @@ -98,16 +97,13 @@ internal class YamlVssParser(private val elementDelimiter: String = "") : VssPar
val min = fetchValue(KEY_DATA_MIN, yamlElementJoined, delimiter) ?: ""
val max = fetchValue(KEY_DATA_MAX, yamlElementJoined, delimiter) ?: ""

val vssDataType = VssDataType.find(datatype)
val valueDataType = vssDataType.valueDataType

val vssNodeProperties = VssNodePropertiesBuilder(uuid, type)
.withDescription(description)
.withComment(comment)
.withDataType(datatype)
.withUnit(unit)
.withMin(min, valueDataType)
.withMax(max, valueDataType)
.withMin(min, datatype)
.withMax(max, datatype)
.build()

return VssNodeSpecModel(vssPath, vssNodeProperties)
Expand Down

0 comments on commit deb3b95

Please sign in to comment.