org.nuiton.util
Interface ApplicationConfig.OptionDef

All Superinterfaces:
Serializable
Enclosing class:
ApplicationConfig

public static interface ApplicationConfig.OptionDef
extends Serializable

Le contrat de marquage des options, on utilise cette interface pour caracteriser une option de configuration.

  public enum MyConfigOption implements OptionDef {

   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
 String getDefaultValue()
           
 String getDescription()
           
 String getKey()
           
 Class<?> getType()
           
 boolean isFinal()
           
 boolean isTransient()
           
 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.
 

Method Detail

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:
true si l'option ne peut etre sauvegardee sur disque (utile par exemple pour les mots de passe, ...)

isFinal

boolean isFinal()
Returns:
true si l'option n'est pas modifiable (utilise par exemple pour la version de l'application, ...)

setDefaultValue

void setDefaultValue(String defaultValue)
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


Copyright © 2004-2011 CodeLutin. All Rights Reserved.