sjrd.util.appproperties
Class ApplicationProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by sjrd.util.appproperties.ApplicationProperties
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>
Direct Known Subclasses:
ServerAppProperties

public class ApplicationProperties
extends Properties

Propriétés de l'application

Author:
sjrd
See Also:
Serialized Form

Field Summary
private  ApplicationProperty[] availableProperties
          Propriétés disponibles
private static long serialVersionUID
          ID de sérialisation
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
ApplicationProperties()
          Crée les propriétés
ApplicationProperties(ApplicationProperty[] aAvailableProperties)
          Crée les propriétés
ApplicationProperties(Properties defaults)
          Crée les propriétés
 
Method Summary
 boolean getBooleanProperty(ApplicationProperty property)
          Lit la valeur d'une propriété entière
 int getIntegerProperty(ApplicationProperty property)
          Lit la valeur d'une propriété entière
 String getProperty(ApplicationProperty property)
          Lit la valeur d'une propriété
 boolean isPropertySet(ApplicationProperty property)
          Teste si une propriété est renseignée
private static Properties makeDefaultProperties(ApplicationProperty[] availableProperties)
          Construit les propriétés par défauts
 void parseCommandLine(String[] args)
          Parse la ligne de commande et ajoute les paramètres lus
 void parseCommandLine(String[] args, ApplicationProperty[] availableProperties)
          Parse la ligne de commande et ajoute les paramètres lus
 void setBooleanProperty(ApplicationProperty property, boolean value)
          Modifie la valeur d'une propriété entière
 void setIntegerProperty(ApplicationProperty property, int value)
          Modifie la valeur d'une propriété entière
 void setProperty(ApplicationProperty property, String value)
          Modifie la valeur d'une propriété
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
ID de sérialisation

See Also:
Constant Field Values

availableProperties

private ApplicationProperty[] availableProperties
Propriétés disponibles

Constructor Detail

ApplicationProperties

public ApplicationProperties(Properties defaults)
Crée les propriétés

Parameters:
defaults - Propriétés par défaut

ApplicationProperties

public ApplicationProperties(ApplicationProperty[] aAvailableProperties)
Crée les propriétés

Parameters:
aAvailableProperties - Propriétés disponibles

ApplicationProperties

public ApplicationProperties()
Crée les propriétés

Method Detail

makeDefaultProperties

private static Properties makeDefaultProperties(ApplicationProperty[] availableProperties)
Construit les propriétés par défauts

Parameters:
availableProperties - Propriétés par défaut
Returns:
Propriétés par défaut

isPropertySet

public boolean isPropertySet(ApplicationProperty property)
Teste si une propriété est renseignée

Parameters:
property - Propriété
Returns:
true si la propriété est renseignées, false sinon

getProperty

public String getProperty(ApplicationProperty property)
                   throws PropertyNotFoundException
Lit la valeur d'une propriété

Parameters:
property - Propriété
Returns:
Valeur de la propriété
Throws:
PropertyNotFoundException - Propriété non trouvée
See Also:
setProperty(ApplicationProperty, String), Properties.getProperty(String)

setProperty

public void setProperty(ApplicationProperty property,
                        String value)
Modifie la valeur d'une propriété

Parameters:
property - Propriété
value - Nouvelle valeur de la propriété
See Also:
getProperty(ApplicationProperty), Properties.setProperty(String, String)

getIntegerProperty

public int getIntegerProperty(ApplicationProperty property)
                       throws PropertyException
Lit la valeur d'une propriété entière

Parameters:
property - Propriété
Returns:
Valeur de la propriété
Throws:
PropertyNotFoundException - Propriété non trouvée
PropertyFormatException - La propriété n'a pas le bon format
PropertyException
See Also:
setProperty(ApplicationProperty, String), Properties.getProperty(String)

setIntegerProperty

public void setIntegerProperty(ApplicationProperty property,
                               int value)
Modifie la valeur d'une propriété entière

Parameters:
property - Propriété
value - Nouvelle valeur de la propriété
See Also:
getProperty(ApplicationProperty), Properties.setProperty(String, String)

getBooleanProperty

public boolean getBooleanProperty(ApplicationProperty property)
                           throws PropertyException
Lit la valeur d'une propriété entière

Parameters:
property - Propriété
Returns:
Valeur de la propriété
Throws:
PropertyNotFoundException - Propriété non trouvée
PropertyFormatException - La propriété n'a pas le bon format
PropertyException
See Also:
setProperty(ApplicationProperty, String), Properties.getProperty(String)

setBooleanProperty

public void setBooleanProperty(ApplicationProperty property,
                               boolean value)
Modifie la valeur d'une propriété entière

Parameters:
property - Propriété
value - Nouvelle valeur de la propriété
See Also:
getProperty(ApplicationProperty), Properties.setProperty(String, String)

parseCommandLine

public void parseCommandLine(String[] args,
                             ApplicationProperty[] availableProperties)
Parse la ligne de commande et ajoute les paramètres lus

Parameters:
args - Paramètres en ligne de commande
availableProperties - Propriétés disponibles

parseCommandLine

public void parseCommandLine(String[] args)
Parse la ligne de commande et ajoute les paramètres lus

Parameters:
args -