net.sf.okapi.common

## Class BaseParameters

- java.lang.Object
- - net.sf.okapi.common.BaseParameters

- All Implemented Interfaces:
    IParameters
  Direct Known Subclasses:
    Parameters, XLIFFWriterParameters

      public abstract class BaseParameters
      extends java.lang.Object
      implements IParameters

  Base class for properties-like parameters that implement IParameters. See the `ParametersString` documentation for details on the storage format.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ParametersString` | `buffer` Buffer where the parameters are stored during conversion.
    `protected java.lang.String` | `path` Current path of the parameter file.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BaseParameters()` Creates a new BaseParameters object with a null path and an empty buffer.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `getBoolean(java.lang.String name)` Gets the boolean value for the given parameter name.
    `int` | `getInteger(java.lang.String name)` Gets the integer value for a given parameter name.
    `ParametersDescription` | `getParametersDescription()` Gets the description of the parameters.
    `java.lang.String` | `getPath()` Gets the full path of the last file where the parameters where loaded from or saved to.
    `java.lang.String` | `getString(java.lang.String name)` Gets the string value for a given parameter name.
    `void` | `load(java.net.URI inputURI, boolean ignoreErrors)` Loads the parameters from a file.
    `void` | `save(java.lang.String newPath)` Saves the parameters to a file.
    `void` | `setBoolean(java.lang.String name, boolean value)` Sets the boolean value for a given parameter name.
    `void` | `setInteger(java.lang.String name, int value)` Sets the integer value for a given parameter name.
    `void` | `setPath(java.lang.String filePath)` Sets the full path of the file where the parameters are to be saved to.
    `void` | `setString(java.lang.String name, java.lang.String value)` Sets the string value for a given parameter name.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface net.sf.okapi.common.IParameters

      `fromString, reset, toString`

- - ### Field Detail

    - #### path

          protected java.lang.String path

      Current path of the parameter file.

    - #### buffer

          protected ParametersString buffer

      Buffer where the parameters are stored during conversion.

  - ### Constructor Detail

    - #### BaseParameters

          public BaseParameters()

      Creates a new BaseParameters object with a null path and an empty buffer.

  - ### Method Detail

    - #### getPath

          public java.lang.String getPath()

      Description copied from interface: `IParameters`
      Gets the full path of the last file where the parameters where loaded from or saved to.
      Specified by:
        `getPath` in interface `IParameters`
      Returns:
        the full path of the last load() or save(), or null if object was not loaded nor saved.

    - #### setPath

          public void setPath(java.lang.String filePath)

      Description copied from interface: `IParameters`
      Sets the full path of the file where the parameters are to be saved to.
      Specified by:
        `setPath` in interface `IParameters`
      Parameters:
        `filePath` - the full path to set.

    - #### load

          public void load(java.net.URI inputURI,
                  boolean ignoreErrors)

      Description copied from interface: `IParameters`
      Loads the parameters from a file.
      Specified by:
        `load` in interface `IParameters`
      Parameters:
        `inputURI` - the URI of the parameters file to load.
        `ignoreErrors` - true if the load should ignore any error such as file not found. If an error occurs and this is set to true, the method should create the parameters object with its default values.

    - #### save

          public void save(java.lang.String newPath)

      Description copied from interface: `IParameters`
      Saves the parameters to a file.
      Specified by:
        `save` in interface `IParameters`
      Parameters:
        `newPath` - the full path of the parameters file to save.

    - #### getBoolean

          public boolean getBoolean(java.lang.String name)

      Description copied from interface: `IParameters`
      Gets the boolean value for the given parameter name.
      Specified by:
        `getBoolean` in interface `IParameters`
      Parameters:
        `name` - the name of the boolean parameter to retrieve.
      Returns:
        the value of the given parameter, or false if it is not defined.

    - #### setBoolean

          public void setBoolean(java.lang.String name,
                        boolean value)

      Description copied from interface: `IParameters`
      Sets the boolean value for a given parameter name.
      Specified by:
        `setBoolean` in interface `IParameters`
      Parameters:
        `name` - the name of the parameter to set.
        `value` - the new value to set.

    - #### getString

          public java.lang.String getString(java.lang.String name)

      Description copied from interface: `IParameters`
      Gets the string value for a given parameter name.
      Specified by:
        `getString` in interface `IParameters`
      Parameters:
        `name` - the name of the string parameter to retrieve.
      Returns:
        the value of the given parameter, or null if it is not defined.

    - #### setString

          public void setString(java.lang.String name,
                       java.lang.String value)

      Description copied from interface: `IParameters`
      Sets the string value for a given parameter name.
      Specified by:
        `setString` in interface `IParameters`
      Parameters:
        `name` - the name of the parameter to set.
        `value` - the new value to set.

    - #### getInteger

          public int getInteger(java.lang.String name)

      Description copied from interface: `IParameters`
      Gets the integer value for a given parameter name.
      Specified by:
        `getInteger` in interface `IParameters`
      Parameters:
        `name` - the name of the integer parameter to retrieve.
      Returns:
        the value of the given parameter, or 0 if it is not defined.

    - #### setInteger

          public void setInteger(java.lang.String name,
                        int value)

      Description copied from interface: `IParameters`
      Sets the integer value for a given parameter name.
      Specified by:
        `setInteger` in interface `IParameters`
      Parameters:
        `name` - the name of the parameter to set.
        `value` - the new value to set.

    - #### getParametersDescription

          public ParametersDescription getParametersDescription()

      Description copied from interface: `IParameters`
      Gets the description of the parameters.
      Specified by:
        `getParametersDescription` in interface `IParameters`
      Returns:
        the ParametersDescription object for this set of parameters, or null if none is provided.