Just in case if someone will read it:
The BEST solution in java is :
public enum Action {
a{
void doAction(...){
// some code
}
},
b{
void doAction(...){
// some code
}
},
c{
void doAction(...){
// some code
}
};
abstract void doAction (...);
}
The GREAT benefits of such pattern are:
You just do it like (NO switches at all):
void someFunction ( Action action ) {
action.doAction(...);
}
In case if you add new Action called "d" you MUST imlement doAction(...) method
NOTE: This pattern is described in Joshua's Bloch "Effective Java (2nd Edition)"