Package com.dtolabs.utils
Class PropertiesUtil
- java.lang.Object
-
- com.dtolabs.utils.PropertiesUtil
-
public class PropertiesUtil extends java.lang.ObjectPropertiesUtil provides some utility methods for Properties.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacePropertiesUtil.AdderAdder represents an object that can have properties added to it.static classPropertiesUtil.PrefixAdderA Adder that adds new properties to the input Properties object using a given prefix to prepend to the name of all new properties.static classPropertiesUtil.PrefixProducerA Producer that given an input set of properties and a specific prefix, produces another set of properties from all input properties that have that prefix and removes the prefix.static interfacePropertiesUtil.ProducerReader represents an object that can produce Properties.
-
Constructor Summary
Constructors Constructor Description PropertiesUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.CollectionlistPropertiesWithPrefix(java.util.Properties props, java.lang.String prefix)Returns a Collection of all property values that have keys with a certain prefix.static java.util.PropertiespropertiesFromString(java.lang.String propString)Convert a String into a Properties objectstatic java.lang.StringstringFromProperties(java.util.Properties props)Returns the Properties formatted as a String
-
-
-
Method Detail
-
stringFromProperties
public static java.lang.String stringFromProperties(java.util.Properties props) throws java.io.IOExceptionReturns the Properties formatted as a String- Parameters:
props- properties- Returns:
- String format from the Properties
- Throws:
java.io.IOException- if an error occurs
-
propertiesFromString
public static java.util.Properties propertiesFromString(java.lang.String propString) throws java.io.IOExceptionConvert a String into a Properties object- Parameters:
propString- properties string- Returns:
- properties
- Throws:
java.io.IOException- if an error occurs
-
listPropertiesWithPrefix
public static java.util.Collection listPropertiesWithPrefix(java.util.Properties props, java.lang.String prefix)Returns a Collection of all property values that have keys with a certain prefix.- Parameters:
props- the Properties to reaqdprefix- the prefix- Returns:
- Collection of all property values with keys with a certain prefix
-
-