public static MonitoringType fromMonitorType(String monitorType) { if (monitorType == null || monitorType.isEmpty() || monitorType.isBlank()) { throw new InvalidMonitoringType(ExceptionConstant.INVALID_MONITORING_TYPE); } for (MonitoringType monitoringEmailType : MonitoringType.values()) { if (monitoringEmailType.getMonitorType().equals(monitorType)) { return monitoringEmailType; } } throw new InvalidMonitoringType(ExceptionConstant.INVALID_MONITORING_TYPE); }