How to get around the lack of expandability of transfers?

I apologize for how this question can turn out. I really can’t figure out how to say this.

I would very much like the enumeration to expand something else for the sake of using the abstraction method. It would make life easier. Alas, I can’t. So, does anyone know how I can implement a function like calling an abstract method? I tried the interface, but quickly realized that you cannot use the common Enum suite.

Edit 1: I just found this one , I will look at it and see if I can get my answer from the help. I will leave it open and unanswered just in case.

+1
source share
1 answer

We often use a template to allow the expansion of enumerations with external functionality. Sort of

boolean reallyLoveThisDay = dayOfWeek.accept(new DefaultDayOfWeekVisitor<Boolean>() { public Boolean visitMonday(DayOfWeek dayOfWeek) { return false; } public Boolean visitDefault(DayOfWeek dayOfWeek) { return true; } }); 
0
source

All Articles