aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/model/properties
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-03-03 14:13:57 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-03-04 17:48:41 +0100
commitcf0c5043887b1dd38808b0fc12bd8700c9f3b6ba (patch)
tree2afa8a49d240cee38bc66edf0a927cd60f11cd8b /core/src/main/kotlin/model/properties
parent77702901cf9255da9a1390b4f01f986da78e58b6 (diff)
downloaddokka-cf0c5043887b1dd38808b0fc12bd8700c9f3b6ba.tar.gz
dokka-cf0c5043887b1dd38808b0fc12bd8700c9f3b6ba.tar.bz2
dokka-cf0c5043887b1dd38808b0fc12bd8700c9f3b6ba.zip
Refactor extras in ContentNodes
Diffstat (limited to 'core/src/main/kotlin/model/properties')
-rw-r--r--core/src/main/kotlin/model/properties/PropertyContainer.kt7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/src/main/kotlin/model/properties/PropertyContainer.kt b/core/src/main/kotlin/model/properties/PropertyContainer.kt
index d30c6844..7fa46ccb 100644
--- a/core/src/main/kotlin/model/properties/PropertyContainer.kt
+++ b/core/src/main/kotlin/model/properties/PropertyContainer.kt
@@ -14,8 +14,10 @@ class PropertyContainer<C : Any> internal constructor(
else -> throw ClassCastException("Property for $key stored under not matching key type.")
}
+ inline fun <reified T : Any> allOfType(): List<T> = map.values.filterIsInstance<T>()
+
companion object {
- fun <T: Any> empty(): PropertyContainer<T> = PropertyContainer(emptyMap())
+ fun <T : Any> empty(): PropertyContainer<T> = PropertyContainer(emptyMap())
}
}
@@ -41,7 +43,8 @@ fun <C> C.mergeExtras(left: C, right: C): C where C : Any, C : WithExtraProperti
strategies.firstIsInstanceOrNull<MergeStrategy.Fail>()?.error?.invoke()
- val replaces: List<ExtraProperty<C>> = strategies.filterIsInstance<MergeStrategy.Replace<C>>().map { it.newProperty }
+ val replaces: List<ExtraProperty<C>> =
+ strategies.filterIsInstance<MergeStrategy.Replace<C>>().map { it.newProperty }
val needingFullMerge: List<(preMerged: C, left: C, right: C) -> C> =
strategies.filterIsInstance<MergeStrategy.Full<C>>().map { it.merger }