I have the following interface:
public interface ResultEvaluationInterface {
public void evaluateResults(Event e);
}
and now i want to inject in my class depending on my Event.type different classes with the same implementation. Something like that:
@Stateless
@LocalBean
public class ResultEvaluation implements ResultEvaluationInterface {
@Override
public void evaluateResults(Event e) {
switch (e.getType()) {
case Type.Production:
// inject and call ResultEvaluationProductionEJB.evaluateResults(e)
case Type.Development:
// inject and call ResultEvaluationDevelopmentEJB.evaluateResults(e)
default:
throw new UnsupportedOperationException("Not supported yet.");
}
}
}
ResultEvaluationProductionEJB and ResultEvaluationDevelopmentEJB both implement the interface. Anybody an idea how to do that in a good way?
Aucun commentaire:
Enregistrer un commentaire