// We must iterate the settings when binding.
// Note: do not collapse these loops as that will damage
// early error detection. The runtime is still O(n) in setting count.
for (Map.Entry<Setting, Field> entry : coreSettings.entrySet()) {
Setting setting = entry.getKey();
Class<?> type = entry.getValue().getType();
String value =
propertyMap.containsKey(setting.name()) ? propertyMap.get(setting.name()) : setting
.defaultValue();
if (int.class.equals(type)) {
// Integer defaultValue = null;
// if (!setting.defaultValue().isEmpty()) {
// defaultValue = Integer.parseInt(setting.defaultValue());
// }
bindConstant().annotatedWith(Names.named(setting.name())).to(Integer.parseInt(value));
} else if (boolean.class.equals(type)) {
// Boolean defaultValue = null;
// if (!setting.defaultValue().isEmpty()) {
// defaultValue = Boolean.parseBoolean(setting.defaultValue());
// }
bindConstant().annotatedWith(Names.named(setting.name())).to(
Boolean.parseBoolean(value));
} else if (String.class.equals(type)) {
bindConstant().annotatedWith(Names.named(setting.name())).to(value);
} else {
/** Not supported **/
/*
* String[] value = config.getStringArray(setting.name()); if
* (value.length == 0 && !setting.defaultValue().isEmpty()) { value