I have enum class with values which are suppose to grow by time and I want users who add new enum values also provide the impementation somewhere. But I am not sure how to force them to provide impementation as impementation will be in some other class. For e.g.
public enum DayType {
SUNDAY,
MONDAY;
}
Referred in a class
class X{
DateType dateType;
..
}
And used in some other class
if (x.getDateType().equals(DayType.SUNDAY)) {
...
}else if(x.getDateType().equals(DayType.MONDAY)){
..
}
So if someone adds DateType then he should be forced to add impementation in above if-else logic as well. Preferably by adding functional interfaces if possible?
I can not force impementation in enum class as the impementation has spring dependencies.