* @return
*/
@SuppressWarnings("unchecked")
private FeatureState createFeatureState(final Feature feature, final Entity featureEntity) {
final Boolean enabled = (Boolean) featureEntity.getProperty(ENABLED);
final FeatureState state = new FeatureState(feature, enabled);
final String strategyId = (String) featureEntity.getProperty(STRATEGY_ID);
if (!Strings.isNullOrEmpty(strategyId)) {
state.setStrategyId(strategyId.trim());
}
final List<String> strategyParamsNames = (List<String>) featureEntity.getProperty(STRATEGY_PARAMS_NAMES);
final List<String> strategyParamsValues = (List<String>) featureEntity.getProperty(STRATEGY_PARAMS_VALUES);
if (strategyParamsNames != null && strategyParamsValues != null && !strategyParamsNames.isEmpty()
&& !strategyParamsValues.isEmpty() && strategyParamsNames.size() == strategyParamsValues.size()) {
for (int i = 0; i < strategyParamsNames.size(); i++) {
state.setParameter(strategyParamsNames.get(i), strategyParamsValues.get(i));
}
}
return state;
}