net.sf.okapi.common

## Class StringParameters

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

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

      public class StringParameters
      extends BaseParameters

  Parameters implementation based on `ParametersString`.

  Subclasses that wish to expose individual parameters via dedicated getters and setters should rely on the internal param buffer as much as possible. Any default values should be set in the implementation of `reset()`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ParametersString` | `buffer` Buffer where the parameters are stored during conversion.

    - ### Fields inherited from class net.sf.okapi.common.BaseParameters

      `path`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StringParameters()` Creates a new StringParameters object with a null path and an empty buffer.
    `StringParameters(java.lang.String data)` Creates a new StringParameters object with a null path the specified initial parameter data

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `fromString(java.lang.String data)` Reset this parameters object to its default values and then load additional parameters from the provided data.
    `void` | `fromString(java.lang.String data, boolean clearParameters)` Load additional parameters from the provided data.
    `boolean` | `getBoolean(java.lang.String name)` Gets the boolean value for the given parameter name.
    `protected java.lang.String` | `getGroup(java.lang.String name)`
    `int` | `getInteger(java.lang.String name)` Gets the integer value for a given parameter name.
    `java.lang.String` | `getString(java.lang.String name)` Gets the string value for a given parameter name.
    `void` | `reset()` Reset this parameters object to its default values.
    `void` | `setBoolean(java.lang.String name, boolean value)` Sets the boolean value for a given parameter name.
    `protected void` | `setGroup(java.lang.String name, java.lang.String value)`
    `void` | `setInteger(java.lang.String name, int value)` Sets the integer value for a given parameter name.
    `void` | `setString(java.lang.String name, java.lang.String value)` Sets the string value for a given parameter name.
    `java.lang.String` | `toString()` Serialize this parameters object to a string.

    - ### Methods inherited from class net.sf.okapi.common.BaseParameters

      `getParametersDescription, getPath, load, load, save, setPath`

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

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

- - ### Field Detail

    - #### buffer

          protected ParametersString buffer

      Buffer where the parameters are stored during conversion.

  - ### Constructor Detail

    - #### StringParameters

          public StringParameters()

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

    - #### StringParameters

          public StringParameters(java.lang.String data)

      Creates a new StringParameters object with a null path the specified initial parameter data
      Parameters:
        `data` - the string holding the parameters. See `IParameters.fromString(java.lang.String)`.

  - ### Method Detail

    - #### reset

          public void reset()

      Reset this parameters object to its default values.

      Subclasses should override this method to set any initial values and instantiate any objects that require allocation. It is recommended that subclasses also call `super.reset()` in the override to ensure that the buffer is empty.

    - #### fromString

          public void fromString(java.lang.String data)

      Reset this parameters object to its default values and then load additional parameters from the provided data.

      Subclasses should not normally need to override this method unless they are maintaining complex values (eg, `InlineCodeFinder`) that require extra initialization as part of their parameter state.

      Parameters:
        `data` - the string holding the parameters. It must be formatted as the string generated by toString(). Line-breaks must be normalized to '\n'. It can also be null or empty, in such case the parameters are left with their current values. Use reset() to reset the parameters to their defaults.

    - #### fromString

          public void fromString(java.lang.String data,
                                 boolean clearParameters)

      Load additional parameters from the provided data. If clearParameters is set, then it first resets this parameters object to its default values.

      Subclasses should not normally need to override this method unless they are maintaining complex values (eg, `InlineCodeFinder`) that require extra initialization as part of their parameter state.

      Parameters:
        `data` - the string holding the parameters. See `IParameters.fromString(java.lang.String)`.
        `clearParameters` - if true, the internal parameters will be cleared before loading the data. If false, any existing parameters will be left intact unless they are overridden by the data.

    - #### toString

          public java.lang.String toString()

      Serialize this parameters object to a string.

      Subclasses should not normally need to override this method unless they are maintaining complex values (eg, `InlineCodeFinder`) that require extra serialization as part of their parameter state.

      Specified by:
        `toString` in interface `IParameters`
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        the string holding all the parameters.

    - #### getBoolean

          public boolean getBoolean(java.lang.String name)

      Description copied from interface: `IParameters`
      Gets the boolean value for the given parameter name.
      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.
      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.
      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.
      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.
      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.
      Parameters:
        `name` - the name of the parameter to set.
        `value` - the new value to set.

    - #### getGroup

          protected java.lang.String getGroup(java.lang.String name)

    - #### setGroup

          protected void setGroup(java.lang.String name,
                                  java.lang.String value)