public interface ConfigOptionDef extends Serializable
public enum MyConfigOption implements ConfigOptionDef {
APP_CONFIG_FILE(
ApplicationConfig.CONFIG_FILE_NAME,
"Main configuration app file",
"myApp-config.properties",
String.class, true, true),
APP_NAME(
ApplicationConfig.CONFIG_FILE_NAME,
Application name,
"MyApp",
String.class, true, true);
public String key;
public String description;
public String defaultValue;
public Class<?> type;
public boolean isTransient;
public boolean isFinal;
private WikittyConfigOption(String key, String description,
String defaultValue, Class<?> type, boolean isTransient, boolean isFinal) {
this.key = key;
this.description = description;
this.defaultValue = defaultValue;
this.type = type;
this.isTransient = isTransient;
this.isFinal = isFinal;
}
@Override
public boolean isFinal() {
return isFinal;
}
@Override
public boolean isTransient() {
return isTransient;
}
@Override
public String getDefaultValue() {
return defaultValue;
}
@Override
public String getDescription() {
return description;
}
@Override
public String getKey() {
return key;
}
@Override
public Class<?> getType() {
return type;
}
@Override
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
@Override
public void setTransient(boolean isTransient) {
this.isTransient = isTransient;
}
@Override
public void setFinal(boolean isFinal) {
this.isFinal = isFinal;
}
}
| Modifier and Type | Method and Description |
|---|---|
String |
getDefaultValue() |
String |
getDescription() |
String |
getKey() |
Class<?> |
getType() |
boolean |
isFinal() |
boolean |
isTransient() |
static OptionModel |
of(ConfigOptionDef configOptionDef) |
void |
setDefaultValue(String defaultValue)
Changes the default value of the option.
|
void |
setFinal(boolean isFinal)
Changes the final state of the option.
|
void |
setTransient(boolean isTransient)
Changes the transient state of the option.
|
static OptionModel of(ConfigOptionDef configOptionDef)
String getKey()
Class<?> getType()
String getDescription()
String getDefaultValue()
void setDefaultValue(String defaultValue)
defaultValue - the new default value of the optionboolean isTransient()
true si l'option ne peut etre sauvegardee sur
disque (utile par exemple pour les mots de passe, ...)void setTransient(boolean isTransient)
isTransient - the new value of the transient stateboolean isFinal()
true si l'option n'est pas modifiable (utilise
par exemple pour la version de l'application, ...)void setFinal(boolean isFinal)
isFinal - the new transient state valueCopyright © 2016–2018 Ultreia.io. All rights reserved.