
util.Flag.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of evaluation-proxy-core Show documentation
Show all versions of evaluation-proxy-core Show documentation
Core package for Amplitude's evaluation proxy.
The newest version!
package com.amplitude.util
import com.amplitude.experiment.evaluation.EvaluationFlag
fun EvaluationFlag.getFlagVersion(): Long? {
val value = this.metadata?.get("flagVersion")
return when (value) {
null -> null
is Long -> value
is Int -> value.toLong()
is Double -> value.toLong()
is Float -> value.toLong()
is String -> value.toLongOrNull()
is Number -> value.toLong()
else -> null
}
}
fun EvaluationFlag.isNewerThan(flag: EvaluationFlag?): Boolean {
return (this.getFlagVersion() ?: Long.MAX_VALUE) > (flag?.getFlagVersion() ?: 0L)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy