mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 02:09:59 +07:00
DO-2480 update FUS reporting lib version to 1.0.226
Update String and ValidatedByAllowedValues methods inside eventFields GitOrigin-RevId: c18ef645531a62f2f7ebdf76d45c0a550366cdf8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bc9339c6a7
commit
845b88dd44
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.platform.experiment.ab.impl.statistic
|
||||
|
||||
import com.intellij.internal.statistic.eventLog.validator.ValidationResultType;
|
||||
import com.intellij.internal.statistic.eventLog.validator.ValidationResultType
|
||||
import com.intellij.internal.statistic.eventLog.validator.rules.EventContext
|
||||
import com.intellij.internal.statistic.eventLog.validator.rules.impl.CustomValidationRule
|
||||
import com.intellij.platform.experiment.ab.impl.ABExperimentOption
|
||||
|
||||
@@ -53,12 +53,29 @@ abstract class StringEventField(override val name: String) : PrimitiveEventField
|
||||
}
|
||||
|
||||
data class ValidatedByAllowedValues(@NonNls @EventFieldName override val name: String,
|
||||
val allowedValues: List<String>,
|
||||
@NonNls override val description: String? = null) : StringEventField(name) {
|
||||
constructor(name: String, allowedValues: List<String>) : this(name, allowedValues, null)
|
||||
|
||||
override val validationRule: List<String>
|
||||
get() = listOf("{enum:${allowedValues.joinToString("|")}}")
|
||||
}
|
||||
|
||||
/**
|
||||
* String event field validated against a predefined list of allowed values,
|
||||
* with optional support for required and default value validation rules.
|
||||
*
|
||||
* @param name name of the field
|
||||
* @param allowedValues list of allowed values for the field
|
||||
* @param description optional description of the field
|
||||
* @param required whether the field is required
|
||||
* @param defaultValue optional default value applied when the field is missing or invalid
|
||||
*/
|
||||
data class ValidatedByAllowedValuesExtended(@NonNls @EventFieldName override val name: String,
|
||||
val allowedValues: List<String>,
|
||||
@NonNls override val description: String? = null,
|
||||
override val required: Boolean? = null,
|
||||
override val defaultValue: String? = null) : StringEventField(name) {
|
||||
constructor(name: String, allowedValues: List<String>) : this(name, allowedValues, null)
|
||||
|
||||
override val validationRule: List<String>
|
||||
get() = buildList {
|
||||
add("{enum:${allowedValues.joinToString("|")}}")
|
||||
|
||||
@@ -103,6 +103,18 @@ object EventFields {
|
||||
fun StringListValidatedByDictionary(name: String, dictionary: String, description: String? = null): StringListEventField =
|
||||
StringListEventField.ValidatedByDictionary(name, dictionary, description)
|
||||
|
||||
/**
|
||||
* Creates a field that allows only a specific list of values
|
||||
* @param name name of the field
|
||||
* @param allowedValues list of allowed values, e.g [ "bool", "int", "float"]
|
||||
*/
|
||||
@JvmStatic
|
||||
fun String(@NonNls @EventFieldName name: String, allowedValues: List<String>, @NonNls description: String?): StringEventField =
|
||||
StringEventField.ValidatedByAllowedValues(name, allowedValues, description)
|
||||
|
||||
@JvmStatic
|
||||
fun String(@NonNls @EventFieldName name: String, allowedValues: List<String>): StringEventField = String(name, allowedValues, null)
|
||||
|
||||
/**
|
||||
* Creates a field that allows only a specific list of values
|
||||
* @param name name of the field
|
||||
@@ -112,7 +124,6 @@ object EventFields {
|
||||
* @param defaultValue optional default value for the field
|
||||
*/
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun String(
|
||||
@NonNls @EventFieldName name: String,
|
||||
allowedValues: List<String>,
|
||||
@@ -120,7 +131,7 @@ object EventFields {
|
||||
required: Boolean? = null,
|
||||
defaultValue: String? = null,
|
||||
): StringEventField =
|
||||
StringEventField.ValidatedByAllowedValues(name, allowedValues, description, required, defaultValue)
|
||||
StringEventField.ValidatedByAllowedValuesExtended(name, allowedValues, description, required, defaultValue)
|
||||
|
||||
@JvmStatic
|
||||
fun Int(@NonNls @EventFieldName name: String, @NonNls description: String?): IntEventField = IntEventField(name, description)
|
||||
|
||||
Reference in New Issue
Block a user