I have a functionality which expects aliases for certain operations
For example - count_mean has alias mean and countDistinct has alias approxCountDistinct
"count_missing", "countMissing" -> this.countMissing.toDouble().right()
"count" -> this.count.toDouble().right()
"count_populated", "countPopulated" -> this.countPopulated.toDouble().right()
"count_distinct", "countDistinct", "approxCountDistinct" -> this.countDistinct.toDouble().right()
"count_mean", "mean" -> this.getDecimalData("mean").right()
I want to create an Enum class or something else to efficiently separate all the types of metrics in another file.
Right now I was thinking of Enum class
enum class FieldProfileMetrics(val value: String) {
CountDistinct("countDistinct", "approxDistinctCount", "count_distinct")
.
.
}
Followed by using the enum class like this, which would return the appropriate metric from Enum (using the aliases to check)
val metric = FieldProfileMetrics.valueOf(metricName)
Any help to figure a better way to structure this is appreciated