I want to reduce cyclomatic complexity of my switch case my code is :
public String getCalenderName() {
switch (type) {
case COUNTRY:
r
public String getName() {
if (type == null) {
return name;
}
if (type == BusinessCalendarType.COUNTRY) {
return country == null ? name : country.getName() + HOLIDAY_CALENDAR;
} else if (type == BusinessCalendarType.CCP) {
return ccp == null ? name : ccp.getName() + " CCP" + HOLIDAY_CALENDAR;
} else if (type == BusinessCalendarType.EXCHANGE) {
return exchange == null ? name : exchange.getName() + HOLIDAY_CALENDAR;
} else if (type == BusinessCalendarType.TENANT) {
return tenant == null ? name : tenant.getName() + HOLIDAY_CALENDAR;
} else {
return name;
}
}
this worked for me