Package org.nuiton.config
Interface ConfigOptionDef
- All Superinterfaces:
Serializable
Le contrat de marquage des options, on utilise cette interface pour
caracteriser une option de configuration.
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;
}
}
- Since:
- 1.0.0-rc-9
-
Method Summary
Modifier and TypeMethodDescriptiongetKey()Class<?>getType()booleanisFinal()booleanvoidsetDefaultValue(String defaultValue) Changes the default value of the option.voidsetFinal(boolean isFinal) Changes the final state of the option.voidsetTransient(boolean isTransient) Changes the transient state of the option.
-
Method Details
-
getKey
String getKey()- Returns:
- la clef identifiant l'option
-
getType
Class<?> getType()- Returns:
- le type de l'option
-
getDescription
String getDescription()- Returns:
- la clef i18n de description de l'option
-
getDefaultValue
String getDefaultValue()- Returns:
- la valeur par defaut de l'option sous forme de chaine de caracteres
-
isTransient
boolean isTransient()- Returns:
truesi l'option ne peut etre sauvegardee sur disque (utile par exemple pour les mots de passe, ...)
-
isFinal
boolean isFinal()- Returns:
truesi l'option n'est pas modifiable (utilise par exemple pour la version de l'application, ...)
-
setDefaultValue
Changes the default value of the option.- Parameters:
defaultValue- the new default value of the option
-
setTransient
void setTransient(boolean isTransient) Changes the transient state of the option.- Parameters:
isTransient- the new value of the transient state
-
setFinal
void setFinal(boolean isFinal) Changes the final state of the option.- Parameters:
isFinal- the new transient state value
-