Package org.intermine.util
Class PropertiesUtil
- java.lang.Object
-
- org.intermine.util.PropertiesUtil
-
public final class PropertiesUtil extends java.lang.Object
Convenience class for working with global properties- Author:
- Andrew Varley
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Properties
getProperties()
Returns all InterMine propertiesstatic java.util.Properties
getPropertiesStartingWith(java.lang.String str)
Returns all global Properties that begin with strstatic java.util.Properties
getPropertiesStartingWith(java.lang.String str, java.util.Properties props)
Returns all Properties in props that begin with strstatic java.util.Properties
loadProperties(java.lang.String resourceName)
Load a specified properties resourcestatic java.lang.String
serialize(java.util.Properties props)
Serialize properties to a string suitable for a subsequent load()static java.util.Properties
stripStart(java.lang.String prefix, java.util.Properties props)
Strips the given string off the keys of the given Properties, and returns a new set of properties.
-
-
-
Method Detail
-
getProperties
public static java.util.Properties getProperties()
Returns all InterMine properties- Returns:
- the global properties for InterMine
-
getPropertiesStartingWith
public static java.util.Properties getPropertiesStartingWith(java.lang.String str, java.util.Properties props)
Returns all Properties in props that begin with str- Parameters:
str
- the String that the returned properties should start withprops
- the Properties to search through- Returns:
- a Properties object containing the subset of props
-
getPropertiesStartingWith
public static java.util.Properties getPropertiesStartingWith(java.lang.String str)
Returns all global Properties that begin with str- Parameters:
str
- the String that the returned properties should start with- Returns:
- a Properties object containing the subset of the global properties
-
stripStart
public static java.util.Properties stripStart(java.lang.String prefix, java.util.Properties props)
Strips the given string off the keys of the given Properties, and returns a new set of properties. The original properties are not altered. For example, given the property:
database.name=production
stripStart("database", props)
will produce:name=production
- Parameters:
prefix
- the String to strip off - a "." will be appended to this string.props
- the Properties object to change- Returns:
- a Properties object containing the same properties with the initial string + "." stripped off the keys
-
serialize
public static java.lang.String serialize(java.util.Properties props) throws java.io.IOException
Serialize properties to a string suitable for a subsequent load()- Parameters:
props
- the properties- Returns:
- the string
- Throws:
java.io.IOException
- if an error occurs
-
loadProperties
public static java.util.Properties loadProperties(java.lang.String resourceName)
Load a specified properties resource- Parameters:
resourceName
- the resourceName of the properties file- Returns:
- the corresponding Properties object
-
-