net.sf.okapi.common
Interface IParameters

All Known Implementing Classes:
BaseParameters, Parameters, XLIFFWriterParameters

public interface IParameters

Common way for a component to expose its parameters in a generic way.


Method Summary
 void fromString(java.lang.String data)
          Parses the parameters stored into a string back into the object.
 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 reset()
          Reset the parameters to their default values.
 void save(java.lang.String filePath)
          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.
 java.lang.String toString()
          Converts the parameters into a string.
 

Method Detail

reset

void reset()
Reset the parameters to their default values.


toString

java.lang.String toString()
Converts the parameters into a string.

Overrides:
toString in class java.lang.Object
Returns:
the string holding all the parameters.

fromString

void fromString(java.lang.String data)
Parses the parameters stored into a string back into the object.

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.

load

void load(java.net.URI inputURI,
          boolean ignoreErrors)
Loads the parameters from a file.

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

void save(java.lang.String filePath)
Saves the parameters to a file.

Parameters:
filePath - the full path of the parameters file to save.
Throws:
java.lang.Exception

getPath

java.lang.String getPath()
Gets the full path of the last file where the parameters where loaded from or saved to.

Returns:
the full path of the last load() or save(), or null if object was not loaded nor saved.

setPath

void setPath(java.lang.String filePath)
Sets the full path of the file where the parameters are to be saved to.

Parameters:
filePath - the full path to set.

getBoolean

boolean getBoolean(java.lang.String name)
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

void setBoolean(java.lang.String name,
                boolean value)
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

java.lang.String getString(java.lang.String name)
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

void setString(java.lang.String name,
               java.lang.String value)
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

int getInteger(java.lang.String name)
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

void setInteger(java.lang.String name,
                int value)
Sets the integer value for a given parameter name.

Parameters:
name - the name of the parameter to set.
value - the new value to set.

getParametersDescription

ParametersDescription getParametersDescription()
Gets the description of the parameters.

Returns:
the ParametersDescription object for this set of parameters, or null if none is provided.