Log warnings in constructor if SettingImpl default value is invalid
/**
* {@inheritDoc}
+ *
* @param <T> The type of the value this {@link SettingImpl} contains.
*/
public class SettingImpl<T> implements Setting<T> {
/**
* Creates a new {@link SettingImpl} with the given id and default value but no validator.
+ *
* @param id the id of the setting.
* @param defaultValue the default value of the setting.
*/
@@ -54,6 +56,7 @@ public SettingImpl(SimpleUri id, T defaultValue) {
/**
* Creates a new {@link SettingImpl} with the given id, default value and validator.
+ *
* @param id the id of the setting.
* @param defaultValue the default value of the setting.
* @param validator the validator to be used to validate values.
@@ -64,7 +67,8 @@ public SettingImpl(SimpleUri id, T defaultValue, SettingValueValidator<T> valida
this.validator = validator;
if (!validate(defaultValue))
- throw new IllegalArgumentException("The default value must be a valid value.");
+ throw new IllegalArgumentException("The default value must be a valid value. " +
+ "Check the logs for more information.");
this.defaultValue = defaultValue;
this.value = this.defaultValue;
@@ -79,7 +83,7 @@ private void dispatchChangedEvent(PropertyChangeEvent event) {
}
private boolean validate(T value) {
- return validator == null || validator.fastValidate(value);
+ return validator == null || validator.validate(value);
}
/**
