Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2000-2018 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.
*/
@file:Suppress("unused")
package kotlin.script.experimental.api
import java.io.Serializable
import kotlin.reflect.KClass
import kotlin.script.experimental.host.ScriptingHostConfiguration
import kotlin.script.experimental.host.getEvaluationContext
import kotlin.script.experimental.util.PropertiesCollection
interface ScriptEvaluationConfigurationKeys
/**
* The container for script evaluation configuration
* For usages see actual code examples
*/
open class ScriptEvaluationConfiguration(baseEvaluationConfigurations: Iterable, body: Builder.() -> Unit) :
PropertiesCollection(Builder(baseEvaluationConfigurations).apply(body).data) {
constructor(body: Builder.() -> Unit = {}) : this(emptyList(), body)
constructor(
vararg baseConfigurations: ScriptEvaluationConfiguration, body: Builder.() -> Unit = {}
) : this(baseConfigurations.asIterable(), body)
class Builder internal constructor(baseEvaluationConfigurations: Iterable) :
ScriptEvaluationConfigurationKeys,
PropertiesCollection.Builder(baseEvaluationConfigurations)
companion object : ScriptEvaluationConfigurationKeys
object Default : ScriptEvaluationConfiguration()
}
/**
* An alternative to the constructor with base configuration, which returns a new configuration only if [body] adds anything
* to the original one, otherwise returns original
*/
fun ScriptEvaluationConfiguration?.with(body: ScriptEvaluationConfiguration.Builder.() -> Unit): ScriptEvaluationConfiguration {
val newConfiguration =
if (this == null) ScriptEvaluationConfiguration(body = body)
else ScriptEvaluationConfiguration(this, body = body)
return if (newConfiguration != this) newConfiguration else this
}
/**
* The list of actual script implicit receiver object, in the same order as specified in {@link ScriptCompilationConfigurationKeys#implicitReceivers}
*/
val ScriptEvaluationConfigurationKeys.implicitReceivers by PropertiesCollection.key>()
/**
* The map of names to actual provided properties objects, according to the properties specified in
* {@link ScriptCompilationConfigurationKeys#providedProperties}
*/
val ScriptEvaluationConfigurationKeys.providedProperties by PropertiesCollection.key