info.jonclark.util
Class PropertyUtils
java.lang.Object
info.jonclark.util.PropertyUtils
public class PropertyUtils
- extends Object
Utilities for working with the java.util.Properties class.
- Author:
- Jonathan
PropertyUtils
public PropertyUtils()
getProperties
public static Properties getProperties(String path)
throws FileNotFoundException,
IOException
- Throws:
FileNotFoundException
IOException
validateProperties
public static void validateProperties(Properties props,
String[] mandatoryValues)
throws PropertiesException
- Checks to see if a Properties object contains all mandatory values
(so that you don't end up with any null Strings)
- Parameters:
props - The Properties object to be validatedmandatoryValues - A String array with all of the keys that must be
contained within the Properties object.
- Throws:
PropertiesException
validateProperties
public static <T> void validateProperties(Properties props,
T[] mandatoryValues)
throws PropertiesException
- Checks to see if a Properties object contains all mandatory values
(so that you don't end up with any null Strings)
- Parameters:
props - The Properties object to be validatedmandatoryValues - An array of objects whose toString() values must have
matching keys contained within the Properties object.
- Throws:
PropertiesException
saveProperties
public static void saveProperties(String path,
Properties prop)
throws FileNotFoundException,
IOException
- Throws:
FileNotFoundException
IOException