aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorvmishenev <vad-mishenev@yandex.ru>2021-09-21 21:38:44 +0300
committervmishenev <vad-mishenev@yandex.ru>2021-09-21 21:40:12 +0300
commit1ada27414d66e58b19e20a968834356e81dd26b2 (patch)
tree41a1f463df9f261fc8c0a7569088263310c227de /core
parent2c6169ad8c3f97e7b9f833879967497efd54ac2e (diff)
downloaddokka-1ada27414d66e58b19e20a968834356e81dd26b2.tar.gz
dokka-1ada27414d66e58b19e20a968834356e81dd26b2.tar.bz2
dokka-1ada27414d66e58b19e20a968834356e81dd26b2.zip
Fix link to javadoc enum entry (#2131)
Diffstat (limited to 'core')
-rw-r--r--core/api/core.api18
-rw-r--r--core/src/main/kotlin/links/DRI.kt21
2 files changed, 39 insertions, 0 deletions
diff --git a/core/api/core.api b/core/api/core.api
index ed83f3a7..24f103d7 100644
--- a/core/api/core.api
+++ b/core/api/core.api
@@ -460,6 +460,20 @@ public final class org/jetbrains/dokka/links/DRI$Companion {
public final fun getTopLevel ()Lorg/jetbrains/dokka/links/DRI;
}
+public final class org/jetbrains/dokka/links/DRIExtraContainer {
+ public fun <init> ()V
+ public fun <init> (Ljava/lang/String;)V
+ public synthetic fun <init> (Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
+ public final fun encode ()Ljava/lang/String;
+ public final fun getData ()Ljava/lang/String;
+ public final fun getMap ()Ljava/util/Map;
+}
+
+public abstract class org/jetbrains/dokka/links/DRIExtraProperty {
+ public fun <init> ()V
+ public final fun getKey ()Ljava/lang/String;
+}
+
public final class org/jetbrains/dokka/links/DRIKt {
public static final fun getDriOfAny ()Lorg/jetbrains/dokka/links/DRI;
public static final fun getDriOfUnit ()Lorg/jetbrains/dokka/links/DRI;
@@ -478,6 +492,10 @@ public abstract class org/jetbrains/dokka/links/DriTarget {
public final class org/jetbrains/dokka/links/DriTarget$Companion {
}
+public final class org/jetbrains/dokka/links/EnumEntryDRIExtra : org/jetbrains/dokka/links/DRIExtraProperty {
+ public static final field INSTANCE Lorg/jetbrains/dokka/links/EnumEntryDRIExtra;
+}
+
public final class org/jetbrains/dokka/links/JavaClassReference : org/jetbrains/dokka/links/TypeReference {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
diff --git a/core/src/main/kotlin/links/DRI.kt b/core/src/main/kotlin/links/DRI.kt
index 25b9546f..c646934d 100644
--- a/core/src/main/kotlin/links/DRI.kt
+++ b/core/src/main/kotlin/links/DRI.kt
@@ -1,7 +1,10 @@
package org.jetbrains.dokka.links
+import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonTypeInfo
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id.CLASS
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.module.kotlin.readValue
/**
* [DRI] stands for DokkaResourceIdentifier
@@ -23,6 +26,24 @@ data class DRI(
}
}
+object EnumEntryDRIExtra: DRIExtraProperty<EnumEntryDRIExtra>()
+
+abstract class DRIExtraProperty<T> {
+ val key: String = this::class.qualifiedName
+ ?: (this.javaClass.let { it.`package`.name + "." + it.simpleName.ifEmpty { "anonymous" } })
+}
+
+class DRIExtraContainer(val data: String? = null) {
+ val map: MutableMap<String, Any> = if (data != null) ObjectMapper().readValue(data) else mutableMapOf()
+ inline operator fun <reified T> get(prop: DRIExtraProperty<T>): T? =
+ map[prop.key]?.let { prop as? T }
+
+ inline operator fun <reified T> set(prop: DRIExtraProperty<T>, value: T) =
+ value.also { map[prop.key] = it as Any }
+
+ fun encode(): String = ObjectMapper().writeValueAsString(map)
+}
+
val DriOfUnit = DRI("kotlin", "Unit")
val DriOfAny = DRI("kotlin", "Any")