aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/model/defaultValues.kt
blob: 426954fb77e0c8c490bdaf44b65e03530b915151 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

package org.jetbrains.dokka.model

import org.jetbrains.dokka.model.properties.ExtraProperty
import org.jetbrains.dokka.model.properties.MergeStrategy

public class DefaultValue(
    public val expression: SourceSetDependent<Expression>
): ExtraProperty<Documentable> {

    @Deprecated("Use `expression` property that depends on source set", ReplaceWith("this.expression.values.first()"))
    public val value: Expression
        get() = expression.values.first()

    public companion object : ExtraProperty.Key<Documentable, DefaultValue> {
        override fun mergeStrategyFor(left: DefaultValue, right: DefaultValue): MergeStrategy<Documentable> =
            MergeStrategy.Replace(DefaultValue(left.expression + right.expression))

    }

    override val key: ExtraProperty.Key<Documentable, *>
        get() = Companion
}

public interface Expression
public data class ComplexExpression(val value: String) : Expression
public data class IntegerConstant(val value: Long) : Expression
public data class StringConstant(val value: String) : Expression
public data class DoubleConstant(val value: Double) : Expression
public data class FloatConstant(val value: Float) : Expression
public data class BooleanConstant(val value: Boolean) : Expression