I have the following method:
<T> String getBeanStrategyName(Store baseStoreModel, T clazz) {
if (clazz instanceof PointsStrategy) {
return baseStoreModel.getPointsStrategy();
} else if (clazz instanceof RedemptionStrategy) {
return baseStoreModel.getRedemptionStrategy();
} else {
return baseStoreModel.getPointsStrategy();
}
}
However when I call the method like this getBeanStrategyName(store,PointsStrategy.class)
, the check clazz instanceof PointsStrategy
returns false. I need somehow to check the passsed type and based on it return particular strategy