I am struggling with preventing call all methods in class hierarchy chain. Lets say i have a base class:
class BaseModel
{ /* Some basic fields goes here */ }
class ModelCompany extends BaseModel
{ /* Fields goes here */ }
Then I want to post two different events:
BaseModel oneEvent = new BaseModel();
ModelCompany otherEvent = new ModelCompany();
EventBus.getDefault().post(oneEvent);
EventBus.getDefault().post(otherEvent);
Somewhere in the activity:
onEvent(BaseModel ev1){}
onEvent(ModelCompany ev2){}
The thing is that both onEvent method will be executed in this case. How to prevent it and post message to exact method?