Package rife.bld.extension.propertyfile
Class PropertyFileUtils
java.lang.Object
rife.bld.extension.propertyfile.PropertyFileUtils
Collection of common methods used in this project.
- Since:
- 1.0
- Author:
- Erik C. Thauvin
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
currentValue
(String value, Object defaultValue, Object newValue) Returns the new value, value or default value depending on which is specified.static boolean
loadProperties
(String command, File file, Properties p, boolean silent) Loads aproperties
file.static void
processDate
(Properties p, EntryDate entry) Processes a dateproperty
.static void
processInt
(Properties p, EntryInt entry) Processes an integerproperty
.static void
processString
(Properties p, Entry entry) Processes a stringproperty
.static void
saveProperties
(File file, String comment, Properties p) Saves aproperties
file.
-
Method Details
-
currentValue
Returns the new value, value or default value depending on which is specified.- Parameters:
value
- the valuedefaultValue
- the default valuenewValue
- the new value- Returns:
- the object
-
loadProperties
public static boolean loadProperties(String command, File file, Properties p, boolean silent) throws ExitStatusException Loads aproperties
file.- Parameters:
command
- the issuing commandfile
- the file locationp
- theproperties
to load into.- Returns:
- the boolean
- Throws:
ExitStatusException
- if an error occurred
-
processDate
Processes a dateproperty
.- Parameters:
p
- theproperty
entry
- theEntry
containing theproperty
edits- Throws:
DateTimeException
- if a parsing error occursIllegalArgumentException
-
processInt
Processes an integerproperty
.- Parameters:
p
- theproperty
entry
- theEntry
containing theproperty
edits- Throws:
NumberFormatException
- if a parsing error occursIllegalArgumentException
-
processString
Processes a stringproperty
. -
saveProperties
Saves aproperties
file.- Parameters:
file
- the file locationcomment
- the header commentp
- theProperties
to save into the file- Throws:
IOException
- the io exception
-