diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/model/aditionalExtras.kt | 9 | ||||
-rw-r--r-- | core/src/main/kotlin/model/properties/PropertyContainer.kt | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/core/src/main/kotlin/model/aditionalExtras.kt b/core/src/main/kotlin/model/aditionalExtras.kt index d9587fe3..b0755759 100644 --- a/core/src/main/kotlin/model/aditionalExtras.kt +++ b/core/src/main/kotlin/model/aditionalExtras.kt @@ -1,5 +1,6 @@ package org.jetbrains.dokka.model +import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.properties.ExtraProperty import org.jetbrains.dokka.model.properties.MergeStrategy @@ -14,4 +15,12 @@ class AdditionalModifiers(val content: Set<ExtraModifiers>) : ExtraProperty<Docu override fun equals(other: Any?): Boolean = if (other is AdditionalModifiers) other.content == content else false override fun hashCode() = content.hashCode() override val key: ExtraProperty.Key<Documentable, *> = AdditionalKey +} + +class Annotations(val content: List<Annotation>) : ExtraProperty<Documentable> { + companion object : ExtraProperty.Key<Documentable, Annotations> + + override val key: ExtraProperty.Key<Documentable, *> = Annotations + + data class Annotation(val dri: DRI, val params: Map<String, String>) }
\ No newline at end of file diff --git a/core/src/main/kotlin/model/properties/PropertyContainer.kt b/core/src/main/kotlin/model/properties/PropertyContainer.kt index 7fa46ccb..5ea42e42 100644 --- a/core/src/main/kotlin/model/properties/PropertyContainer.kt +++ b/core/src/main/kotlin/model/properties/PropertyContainer.kt @@ -15,9 +15,12 @@ class PropertyContainer<C : Any> internal constructor( } inline fun <reified T : Any> allOfType(): List<T> = map.values.filterIsInstance<T>() + fun <D : C> addAll(vararg extras: ExtraProperty<D>): PropertyContainer<D> = + PropertyContainer(map + extras.map { p -> p.key to p }) companion object { fun <T : Any> empty(): PropertyContainer<T> = PropertyContainer(emptyMap()) + fun <T : Any> withAll(vararg extras: ExtraProperty<T>) = empty<T>().addAll(*extras) } } |