```data class MetricFilter<T> (val filterId:...
# announcements
a
Copy code
data class MetricFilter<T> (val filterId: String, val defaultValue: T? ) {
    fun createValue(value: Any?): MetricFilterValue<T> {
        val result: T?
        result = if (value == null) {
            defaultValue ?: throw MetricFilterMustBeSetException(filterId)
        } else {
            if (value is T) {
                value
            } else {
                throw InvalidMetricFilterValueTypeException(filterId)
            }
        }
        return MetricFilterValue(this, result)
    }
}