Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.xmlconfig
Class AbstractParam

    java.lang.Object
      umontreal.iro.lecuyer.xmlconfig.AbstractParam

All Implemented Interfaces:
  Param

Direct Known Subclasses:
  CSVSourceArray2D, DBConnectionParam, DBSourceArray2D, ExcelSourceArray2D, ParamWithSourceArray, PropertyParam, RandomVariateGenParam, TimeParam

    public abstract class AbstractParam

extends Object
implements Param

Provides common attributes for parameter objects. This class pvovides the `id` attribute which can be used to identify an element in the XML file. The `xref` attribute can be used to reference an identified element. Both attributes are of type string.

#### Examples

`<element id="element-id"/>`

`<element xref="element-id"/>`

Constructor Summary
`AbstractParam()`

Method Summary
`void` | `check()` Verifies that every needed parameter was specified.
`static Document` | `createDocument(ClassFinder finder, StorableParam par, String rootName, int spc)` Constructs a DOM document from the storable parameter object `par`, using the class finder `finder` to resolve simple class names, with root element with name `rootName`, and with `spc` spaces of indentation.
`String` | `getId()` Returns the identifier associated with this element.
`String` | `getXref()` Returns the identifier of the referenced element.
`void` | `setId(String id)` Sets the identifier of this parameter element to `id`.
`void` | `setXref(String xref)` Sets the referenced identifier to `xref`.
`String` | `toString()`
`static void` | `write(ClassFinder finder, File file, StorableParam par, String rootName, int spc)` Same as `String, StorableParam, String, int)`, for a file object rather than a file name.
`static void` | `write(ClassFinder finder, OutputStream out, StorableParam par, String rootName, int spc)` Same as `String, StorableParam, String, int)`, but writes the XML contents to the output stream `out`.
`static void` | `write(ClassFinder finder, String fileName, StorableParam par, String rootName, int spc)` Convenience method to write the parameters `par` into an XML file `file`, with a root element name `rootName` and `spc` spaces for each needed indentation level.
`static void` | `write(ClassFinder finder, Writer out, StorableParam par, String rootName, int spc)` Same as `String, StorableParam, String, int)`, but writes the XML contents to the writer `out`.
`static void` | `write(File file, StorableParam par, String rootName, int spc)` Equivalent to `File, StorableParam, String, int) write (new ClassFinder(), file, par, rootName, spc)`.
`static void` | `write(OutputStream out, StorableParam par, String rootName, int spc)` Equivalent to `OutputStream, StorableParam, String, int) write (new ClassFinder(), out, par, rootName, spc)`.
`static void` | `write(String fileName, StorableParam par, String rootName, int spc)` Equivalent to `String, StorableParam, String, int) write (new ClassFinder(), fileName, par, rootName, spc)`.
`static void` | `write(Writer out, StorableParam par, String rootName, int spc)` Equivalent to `Writer, StorableParam, String, int) write (new ClassFinder(), out, par, rootName, spc)`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### AbstractParam

    public AbstractParam()

Method Detail

### getId

    public String getId()

  Returns the identifier associated with this element. By default, this is the empty string.

  Returns:
    the identifier of the element.

### setId

    public void setId(String id)

  Sets the identifier of this parameter element to `id`.

  Parameters:
    `id` - the new identifier of the element.
  Throws:
    `NullPointerException` - if `id` is `null`.

### getXref

    public String getXref()

  Returns the identifier of the referenced element. By default, this is `null`.

  Returns:
    the referenced element identifier.

### setXref

    public void setXref(String xref)

  Sets the referenced identifier to `xref`.

  Parameters:
    `xref` - the new referenced identifier.
  Throws:
    `NullPointerException` - if `xref` is `null`.

### check

    public void check()

  Verifies that every needed parameter was specified. Throws a `ParamReadException` in case of missing parameters.

  Throws:
    `ParamReadException` - if some parameters are missing or invalid.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### write

    public static void write(String fileName,
                             StorableParam par,
                             String rootName,
                             int spc)
                      throws IOException,
                             ParserConfigurationException,
                             TransformerException

  Equivalent to `String, StorableParam, String, int) write (new ClassFinder(), fileName, par, rootName, spc)`.

  Throws:
    `IOException`
    `ParserConfigurationException`
    `TransformerException`

### write

    public static void write(ClassFinder finder,
                             String fileName,
                             StorableParam par,
                             String rootName,
                             int spc)
                      throws IOException,
                             ParserConfigurationException,
                             TransformerException

  Convenience method to write the parameters `par` into an XML file `file`, with a root element name `rootName` and `spc` spaces for each needed indentation level. The class finder `finder` is used to convert `Class` objects into simple names. This method uses an XML transformer to write the document obtained using the `createDocument(umontreal.iro.lecuyer.util.ClassFinder, umontreal.iro.lecuyer.xmlconfig.StorableParam, java.lang.String, int)` method to an XML file.

  Parameters:
    `finder` - the class finder used to format class names.
    `fileName` - the name of the output file.
    `par` - the parameter object to be stored.
    `rootName` - the name of the root element of the XML file.
    `spc` - the number of spaces per indentation level.
  Throws:
    `IOException` - if an I/O error occurs.
    `ParserConfigurationException` - if the XML document builder could not be created.
    `TransformerException` - if the XML transformer could not be created properly.

### write

    public static void write(File file,
                             StorableParam par,
                             String rootName,
                             int spc)
                      throws IOException,
                             ParserConfigurationException,
                             TransformerException

  Equivalent to `File, StorableParam, String, int) write (new ClassFinder(), file, par, rootName, spc)`.

  Throws:
    `IOException`
    `ParserConfigurationException`
    `TransformerException`

### write

    public static void write(ClassFinder finder,
                             File file,
                             StorableParam par,
                             String rootName,
                             int spc)
                      throws IOException,
                             ParserConfigurationException,
                             TransformerException

  Same as `String, StorableParam, String, int)`, for a file object rather than a file name.

  Parameters:
    `finder` - the class finder used to format class names.
    `file` - the object representing the output file.
    `par` - the parameter object to be stored.
    `rootName` - the name of the root element of the XML file.
    `spc` - the number of spaces per indentation level.
  Throws:
    `IOException` - if an I/O error occurs.
    `ParserConfigurationException` - if the XML document builder could not be created.
    `TransformerException` - if the XML transformer could not be created properly.

### write

    public static void write(OutputStream out,
                             StorableParam par,
                             String rootName,
                             int spc)
                      throws IOException,
                             ParserConfigurationException,
                             TransformerException

  Equivalent to `OutputStream, StorableParam, String, int) write (new ClassFinder(), out, par, rootName, spc)`.

  Throws:
    `IOException`
    `ParserConfigurationException`
    `TransformerException`

### write

    public static void write(ClassFinder finder,
                             OutputStream out,
                             StorableParam par,
                             String rootName,
                             int spc)
                      throws IOException,
                             ParserConfigurationException,
                             TransformerException

  Same as `String, StorableParam, String, int)`, but writes the XML contents to the output stream `out`.

  Parameters:
    `finder` - the class finder used to format class names.
    `out` - the output stream for the XML contents.
    `par` - the parameter object to be stored.
    `rootName` - the name of the root element of the XML file.
    `spc` - the number of spaces per indentation level.
  Throws:
    `IOException` - if an I/O error occurs.
    `ParserConfigurationException` - if the XML document builder could not be created.
    `TransformerException` - if the XML transformer could not be created properly.

### write

    public static void write(Writer out,
                             StorableParam par,
                             String rootName,
                             int spc)
                      throws IOException,
                             ParserConfigurationException,
                             TransformerException

  Equivalent to `Writer, StorableParam, String, int) write (new ClassFinder(), out, par, rootName, spc)`.

  Throws:
    `IOException`
    `ParserConfigurationException`
    `TransformerException`

### write

    public static void write(ClassFinder finder,
                             Writer out,
                             StorableParam par,
                             String rootName,
                             int spc)
                      throws IOException,
                             ParserConfigurationException,
                             TransformerException

  Same as `String, StorableParam, String, int)`, but writes the XML contents to the writer `out`.

  Parameters:
    `finder` - the class finder used to format class names.
    `out` - the writer for the XML contents.
    `par` - the parameter object to be stored.
    `rootName` - the name of the root element of the XML file.
    `spc` - the number of spaces per indentation level.
  Throws:
    `IOException` - if an I/O error occurs.
    `ParserConfigurationException` - if the XML document builder could not be created.
    `TransformerException` - if the XML transformer could not be created properly.

### createDocument

    public static Document createDocument(ClassFinder finder,
                                          StorableParam par,
                                          String rootName,
                                          int spc)
                                   throws ParserConfigurationException

  Constructs a DOM document from the storable parameter object `par`, using the class finder `finder` to resolve simple class names, with root element with name `rootName`, and with `spc` spaces of indentation.

  Parameters:
    `finder` - the class finder used to resolve simple class names.
    `par` - the parameter object to write.
    `rootName` - the name of the root element.
    `spc` - the number of spaces of indentation.
  Returns:
    the constructed document.
  Throws:
    `ParserConfigurationException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

To submit a bug or ask questions, send an e-mail to Richard Simard.