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 ObjectcurrentValue(String value, Object defaultValue, Object newValue) Returns the new value, value or default value depending on which is specified.static booleanloadProperties(String command, File file, Properties p, boolean silent) Loads apropertiesfile.static voidprocessDate(Properties p, EntryDate entry) Processes a dateproperty.static voidprocessInt(Properties p, EntryInt entry) Processes an integerproperty.static voidprocessString(Properties p, Entry entry) Processes a stringproperty.static voidsaveProperties(File file, String comment, Properties p) Saves apropertiesfile.
-
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 apropertiesfile.- Parameters:
command- the issuing commandfile- the file locationp- thepropertiesto load into.- Returns:
- the boolean
- Throws:
ExitStatusException- if an error occurred
-
processDate
Processes a dateproperty.- Parameters:
p- thepropertyentry- theEntrycontaining thepropertyedits- Throws:
DateTimeException- if a parsing error occursIllegalArgumentException
-
processInt
Processes an integerproperty.- Parameters:
p- thepropertyentry- theEntrycontaining thepropertyedits- Throws:
NumberFormatException- if a parsing error occursIllegalArgumentException
-
processString
Processes a stringproperty. -
saveProperties
Saves apropertiesfile.- Parameters:
file- the file locationcomment- the header commentp- thePropertiesto save into the file- Throws:
IOException- the io exception
-