diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-03-04 17:04:50 +0100 |
---|---|---|
committer | Kamil Doległo <kamilok1965@users.noreply.github.com> | 2020-03-04 18:00:19 +0100 |
commit | fc875fe5f8bc52ac75053db097b3349465705732 (patch) | |
tree | a2e3291170b88336c906210c5570081a217326b4 /core | |
parent | ea0945efe8c7b5dd9aabc4f049afaac612b70422 (diff) | |
download | dokka-fc875fe5f8bc52ac75053db097b3349465705732.tar.gz dokka-fc875fe5f8bc52ac75053db097b3349465705732.tar.bz2 dokka-fc875fe5f8bc52ac75053db097b3349465705732.zip |
Refactor Modifiers
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/model/Documentable.kt | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index 9116b6e6..d073d39a 100644 --- a/core/src/main/kotlin/model/Documentable.kt +++ b/core/src/main/kotlin/model/Documentable.kt @@ -73,10 +73,21 @@ interface WithType { interface WithAbstraction { val modifier: Modifier +} - enum class Modifier { - Abstract, Open, Final, Sealed, Empty - } +sealed class Modifier(val name: String) +sealed class KotlinModifier(name: String) : Modifier(name) { + object Abstract : KotlinModifier("abstract") + object Open : KotlinModifier("open") + object Final : KotlinModifier("final") + object Sealed : KotlinModifier("sealed") + object Empty : KotlinModifier("") +} + +sealed class JavaModifier(name: String) : Modifier(name) { + object Abstract : JavaModifier("abstract") + object Final : JavaModifier("final") + object Empty : JavaModifier("") } interface WithCompanion { @@ -145,7 +156,7 @@ data class Class( override val generics: List<TypeParameter>, override val supertypes: PlatformDependent<List<DRI>>, override val documentation: PlatformDependent<DocumentationNode>, - override val modifier: WithAbstraction.Modifier, + override val modifier: Modifier, override val platformData: List<PlatformData>, override val extra: PropertyContainer<Class> = PropertyContainer.empty() ) : Classlike(), WithAbstraction, WithCompanion, WithConstructors, WithGenerics, WithSupertypes, @@ -206,7 +217,7 @@ data class Function( override val type: TypeWrapper, override val generics: List<TypeParameter>, override val receiver: Parameter?, - override val modifier: WithAbstraction.Modifier, + override val modifier: Modifier, override val platformData: List<PlatformData>, override val extra: PropertyContainer<Function> = PropertyContainer.empty() ) : Documentable(), Callable, WithGenerics, WithExtraProperties<Function> { @@ -286,7 +297,7 @@ data class Property( override val receiver: Parameter?, val setter: Function?, val getter: Function?, - override val modifier: WithAbstraction.Modifier, + override val modifier: Modifier, override val platformData: List<PlatformData>, override val extra: PropertyContainer<Property> = PropertyContainer.empty() ) : Documentable(), Callable, WithExtraProperties<Property> { @@ -331,7 +342,7 @@ data class OtherParameter(val name: String) : Bound() object Star : Projection() data class TypeConstructor(val dri: DRI, val projections: List<Projection>) : Bound() data class Nullable(val inner: Bound) : Bound() -data class Variance(val kind: Kind, val inner: Bound): Projection() { +data class Variance(val kind: Kind, val inner: Bound) : Projection() { enum class Kind { In, Out } } |