Package net.sf.okapi.common
Class BaseParameters
- java.lang.Object
-
- net.sf.okapi.common.BaseParameters
-
- All Implemented Interfaces:
Cloneable,IParameters
- Direct Known Subclasses:
AbstractMarkupParameters,Parameters,Parameters,StringParameters,YamlParameters
public abstract class BaseParameters extends Object implements IParameters
Base class for properties-like parameters that implement IParameters.
-
-
Constructor Summary
Constructors Constructor Description BaseParameters()Creates a new BaseParameters object with a null path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ParametersDescriptiongetParametersDescription()Gets the description of the parameters.StringgetPath()Gets the full path of the last file where the parameters where loaded from or saved to.voidload(InputStream inStream, boolean ignoreErrors)Loads the parameters from a file.voidload(URL inputURL, boolean ignoreErrors)Loads the parameters from a file.voidsave(String newPath)Saves the parameters to a file.voidsetPath(String filePath)Sets the full path of the file where the parameters are to be saved to.-
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
copy, fromString, getBoolean, getInteger, getString, reset, setBoolean, setInteger, setString, toString
-
-
-
-
Field Detail
-
path
protected String path
Current path of the parameter file.
-
-
Method Detail
-
getPath
public String getPath()
Description copied from interface:IParametersGets the full path of the last file where the parameters where loaded from or saved to.- Specified by:
getPathin interfaceIParameters- Returns:
- the full path of the last load() or save(), or null if object was not loaded nor saved.
-
setPath
public void setPath(String filePath)
Description copied from interface:IParametersSets the full path of the file where the parameters are to be saved to.- Specified by:
setPathin interfaceIParameters- Parameters:
filePath- the full path to set.
-
load
public void load(URL inputURL, boolean ignoreErrors)
Description copied from interface:IParametersLoads the parameters from a file.- Specified by:
loadin interfaceIParameters- Parameters:
inputURL- URL 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.
-
load
public void load(InputStream inStream, boolean ignoreErrors)
Description copied from interface:IParametersLoads the parameters from a file.- Specified by:
loadin interfaceIParameters- Parameters:
inStream- input stream with the parameters 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(String newPath)
Description copied from interface:IParametersSaves the parameters to a file.- Specified by:
savein interfaceIParameters- Parameters:
newPath- the full path of the parameters file to save.
-
getParametersDescription
public ParametersDescription getParametersDescription()
Description copied from interface:IParametersGets the description of the parameters.- Specified by:
getParametersDescriptionin interfaceIParameters- Returns:
- the ParametersDescription object for this set of parameters, or null if none is provided.
-
-