All Downloads are FREE. Search and download functionalities are using the official Maven repository.

divkit.dsl.InputFilterRegex.kt Maven / Gradle / Ivy

Go to download

DivKit is an open source Server-Driven UI (SDUI) framework. SDUI is a an emerging technique that leverage the server to build the user interfaces of their mobile app.

There is a newer version: 30.19.0
Show newest version
@file:Suppress(
    "unused",
    "UNUSED_PARAMETER",
)

package divkit.dsl

import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonValue
import divkit.dsl.annotation.*
import divkit.dsl.core.*
import divkit.dsl.scope.*
import kotlin.Any
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.collections.Map

/**
 * Regex filter.
 * 
 * Can be created using the method [inputFilterRegex].
 * 
 * Required parameters: `type, pattern`.
 */
@Generated
class InputFilterRegex internal constructor(
    @JsonIgnore
    val properties: Properties,
) : InputFilter {
    @JsonAnyGetter
    internal fun getJsonProperties(): Map = properties.mergeWith(
        mapOf("type" to "regex")
    )

    operator fun plus(additive: Properties): InputFilterRegex = InputFilterRegex(
        Properties(
            pattern = additive.pattern ?: properties.pattern,
        )
    )

    class Properties internal constructor(
        /**
         * A regular expression (pattern) that the input value must match.
         */
        val pattern: Property?,
    ) {
        internal fun mergeWith(properties: Map): Map {
            val result = mutableMapOf()
            result.putAll(properties)
            result.tryPutProperty("pattern", pattern)
            return result
        }
    }
}

/**
 * @param pattern A regular expression (pattern) that the input value must match.
 */
@Generated
fun DivScope.inputFilterRegex(
    `use named arguments`: Guard = Guard.instance,
    pattern: String? = null,
): InputFilterRegex = InputFilterRegex(
    InputFilterRegex.Properties(
        pattern = valueOrNull(pattern),
    )
)

/**
 * @param pattern A regular expression (pattern) that the input value must match.
 */
@Generated
fun DivScope.inputFilterRegexProps(
    `use named arguments`: Guard = Guard.instance,
    pattern: String? = null,
) = InputFilterRegex.Properties(
    pattern = valueOrNull(pattern),
)

/**
 * @param pattern A regular expression (pattern) that the input value must match.
 */
@Generated
fun TemplateScope.inputFilterRegexRefs(
    `use named arguments`: Guard = Guard.instance,
    pattern: ReferenceProperty? = null,
) = InputFilterRegex.Properties(
    pattern = pattern,
)

/**
 * @param pattern A regular expression (pattern) that the input value must match.
 */
@Generated
fun InputFilterRegex.override(
    `use named arguments`: Guard = Guard.instance,
    pattern: String? = null,
): InputFilterRegex = InputFilterRegex(
    InputFilterRegex.Properties(
        pattern = valueOrNull(pattern) ?: properties.pattern,
    )
)

/**
 * @param pattern A regular expression (pattern) that the input value must match.
 */
@Generated
fun InputFilterRegex.defer(
    `use named arguments`: Guard = Guard.instance,
    pattern: ReferenceProperty? = null,
): InputFilterRegex = InputFilterRegex(
    InputFilterRegex.Properties(
        pattern = pattern ?: properties.pattern,
    )
)

/**
 * @param pattern A regular expression (pattern) that the input value must match.
 */
@Generated
fun InputFilterRegex.evaluate(
    `use named arguments`: Guard = Guard.instance,
    pattern: ExpressionProperty? = null,
): InputFilterRegex = InputFilterRegex(
    InputFilterRegex.Properties(
        pattern = pattern ?: properties.pattern,
    )
)

@Generated
fun InputFilterRegex.asList() = listOf(this)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy