public static MetricType getByIdentifier(String identifier) { for (int i = 0; i < MetricType.values().length; i++) { MetricType metricType = MetricType.values()[i]; if (metricType.getIdentifier().equals(identifier)) { return metricType; } } return null; }