Alex Spence
06/24/2019, 7:50 PMdata 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)
}
}