org.kaiwitte.joptions
Class OptionManagerFactory

java.lang.Object
  extended by org.kaiwitte.joptions.OptionManagerFactory

public final class OptionManagerFactory
extends java.lang.Object

A factory to create OptionManagers.


Method Summary
static OptionManager createOptionManager(java.io.InputStream in, java.lang.Class node)
          Creates an OptionManager.
static OptionManager createOptionManager(java.io.InputStream in, java.lang.Class node, java.util.ResourceBundle resource)
          Creates an OptionManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createOptionManager

public static OptionManager createOptionManager(java.io.InputStream in,
                                                java.lang.Class node)
                                         throws java.io.IOException
Creates an OptionManager.

Parameters:
in - an InputStream to read the XML configuration data
node - a Class to identify the user node where the Preferences are stored
Returns:
an OptionManager based on the configuration
Throws:
java.io.IOException - iff an IO error occurs or the configuration data has an invalid format
java.lang.NullPointerException - iff any argument is null

createOptionManager

public static OptionManager createOptionManager(java.io.InputStream in,
                                                java.lang.Class node,
                                                java.util.ResourceBundle resource)
                                         throws java.io.IOException
Creates an OptionManager.

Parameters:
in - an InputStream to read the XML configuration data
node - a Class to identify the user node where the Preferences are stored
resource - a ResourceBundle from where to read the option names in the appropriate Locale.

Example: a part of the InputStream data is

<option><name>greeting</name>
Then the ResourceBundle must contain values for "name" and "name_MNEMONIC". It can be null. Then this method is identical to createOptionManager(java.io.InputStream, Class).
Returns:
an OptionManager based on the configuration
Throws:
java.io.IOException - iff an IO error occurs or the configuration data has an invalid format
java.lang.NullPointerException - iff in or node is null
java.util.MissingResourceException - iff a resource value is missing for any option name or its mnemonic (myName_MNEMONIC) and resource != null.