配置选项
public class ConfigOption<T> {
private final String key;
private final T defaultValue;
private final String description;
public ConfigOption(String key, T defaultValue) {
this.key = checkNotNull(key);
this.description = "";
this.defaultValue = defaultValue;
}
public ConfigOption(String key, String description, T defaultValue) {
this.key = checkNotNull(key);
this.description = description;
this.defaultValue = defaultValue;
}
public ConfigOption<T> withDescription(final String description) {
return new ConfigOption<>(key, description, defaultValue);
}
public String key() {
return key;
}
public boolean hasDefaultValue() {
return defaultValue != null;
}
public T defaultValue() {
return defaultValue;
}
public String description() {
return descr