diff --git a/libs/model/src/main/kotlin/de/cyface/model/osm/Way.kt b/libs/model/src/main/kotlin/de/cyface/model/osm/Way.kt index 5de6d5c..e050a6d 100644 --- a/libs/model/src/main/kotlin/de/cyface/model/osm/Way.kt +++ b/libs/model/src/main/kotlin/de/cyface/model/osm/Way.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 Cyface GmbH + * Copyright 2019-2025 Cyface GmbH * * This file is part of the Serialization. * @@ -18,14 +18,11 @@ */ package de.cyface.model.osm -import org.apache.commons.lang3.Validate import java.util.Locale import java.util.Objects import java.util.Optional import java.util.stream.Collectors - - /** * A POJO representing an Open Street Map way. * @@ -46,18 +43,18 @@ class Way : Comparable> { var nodes: Array = emptyArray() get() = field.copyOf() set(value) { - Validate.notNull(value) + requireNotNull(value) field = value.copyOf() } var tags: Map = emptyMap() set(value) { - Validate.notNull(value) + requireNotNull(value) field = value.toMap() } /** - * A no argument constructor as required by Apache flink + * A no argument constructor as required by Apache Flink */ @Suppress("unused") // Part of the API constructor() @@ -71,8 +68,8 @@ class Way : Comparable> { */ @Suppress("unused") // Part of the API constructor(identifier: Long, nodes: Array, tags: Collection) { - Validate.isTrue(identifier > 0L) - Validate.notNull(nodes) + require(identifier > 0L) { "Identifier must be > 0 but was $identifier" } + requireNotNull(nodes) this.identifier = identifier this.nodes = nodes @@ -92,7 +89,7 @@ class Way : Comparable> { * @param tags The tags associated with the way. This might be an empty `Collection` */ fun setTags(tags: Collection) { - Validate.notNull(tags) + requireNotNull(tags) this.tags = tags.stream().collect(Collectors.toMap({ it.key }, { it })) } @@ -102,7 +99,7 @@ class Way : Comparable> { } override fun compareTo(other: Way): Int { - Validate.notNull(other) + requireNotNull(other) return this.identifier.compareTo(other.identifier) }