org.jetbrains.kotlin.lombok.processor.SyntheticParts.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-lombok-compiler-plugin-embeddable Show documentation
Show all versions of kotlin-lombok-compiler-plugin-embeddable Show documentation
Kotlin Lombok Compiler Plugin.embeddable
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.lombok.processor
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
class SyntheticParts(
val methods: List = emptyList(),
val staticFunctions: List = emptyList(),
val constructors: List = emptyList(),
val classes: List = emptyList(),
) {
operator fun plus(other: SyntheticParts): SyntheticParts = SyntheticParts(
methods + other.methods,
staticFunctions + other.staticFunctions,
constructors + other.constructors,
classes + other.classes
)
companion object {
val Empty = SyntheticParts()
}
}
class SyntheticPartsBuilder {
private val methods = mutableListOf()
private val staticFunctions = mutableListOf()
private val constructors = mutableListOf()
private val classes = mutableListOf()
fun addMethod(method: SimpleFunctionDescriptor) {
methods += method
}
fun addStaticFunction(function: SimpleFunctionDescriptor) {
staticFunctions += function
}
fun addConstructor(constructor: ClassConstructorDescriptor) {
constructors += constructor
}
fun addClass(clazz: ClassDescriptor) {
classes += clazz
}
fun build(): SyntheticParts = SyntheticParts(methods, staticFunctions, constructors, classes)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy