net.sourceforge.argval.utils
Interface PropertiesUtil

All Known Implementing Classes:
PropertiesUtilImpl

public interface PropertiesUtil


Field Summary
static String PROP_SEP
          The default separator for property key parts.
 
Method Summary
 Properties addProperties(Properties prop, Class<?> clazz, Properties extraProp)
           
 Properties addProperties(Properties prop, String baseKey, Properties extraProp)
           
 String createKey(String[] keyArray)
          Creates a new key value, by concatinating the key with the two key parts.
 String createKey(String key, String keyPart)
          Creates a new key value, by concatinating the key with the keyPart.
 String createKey(String key, String firstKeyPart, String secondKeyPart)
          Creates a new key value, by concatinating the key with the two key parts.
 Properties getProperties(Class<?> clazz, Properties prop)
           
 Properties getProperties(String baseKey, Properties prop)
          Returns a sub set of Properties, which keys start with the baseKey.
 List<Properties> getPropertiesList(Properties prop, String listPrefixKey)
           
 List<Properties> getPropertiesList(Properties prop, String listPrefixKey, String openingBracket, String closingBracket)
           
 Map<String,Properties> getPropertiesMap(Properties prop, String mapPrefixKey)
           
 Map<String,Properties> getPropertiesMap(Properties prop, String mapPrefixKey, String openingBracket, String closingBracket)
           person[tjeerd].name = Mickey Mouse person[tjeerd].mobile = +31.6.1111 1111 person[esther].name = Donald Duck person[estehr].mobile = +31.6.1111 2222
 List<String> getPropertyAsList(Properties properties, String key)
           
 List<String> getPropertyAsList(Properties properties, String key, String separator)
           
 Set<String> getPropertyAsSet(Properties properties, String key)
          Returns the values of an multiple value property key as a Set instance, which contains all the values.
 Set<String> getPropertyAsSet(Properties properties, String key, String separator)
          Returns the values of an multiple value property key as a Set instance, which contains all the values.
 Properties loadProperties(File propertyFile)
           
 String toString(Properties properties)
          Creates a String which contains all the property key's and their values, separated by the equals sign '='.
 

Field Detail

PROP_SEP

static final String PROP_SEP
The default separator for property key parts.

See Also:
Constant Field Values
Method Detail

createKey

String createKey(String key,
                 String keyPart)
Creates a new key value, by concatinating the key with the keyPart.

When createKey(current_key, "window") is called it will return the String current_key + PROP_SEP + "window".

Parameters:
key - The existing key, to which the keyPart is added.
keyPart - The key part to add.
Returns:
The new concatinated key.

createKey

String createKey(String key,
                 String firstKeyPart,
                 String secondKeyPart)
Creates a new key value, by concatinating the key with the two key parts.

When createKey(current_key, "window", "name") is called it will return the String current_key + ".window.name".

Parameters:
key - The existing key, to which the keyPart's are added.
firstKeyPart - The key part to add.
secondKeyPart - The key part to add.
Returns:
The new concatinated key.
See Also:
createKey(String, String)

createKey

String createKey(String[] keyArray)
Creates a new key value, by concatinating the key with the two key parts.

When createKey(new String[] {"company", "module", "project"}) is called it will return the String "company.module.project".

Parameters:
keyArray - An array of key parts which need to be concatinated.
Returns:
The new concatinated key.

loadProperties

Properties loadProperties(File propertyFile)

getPropertyAsSet

Set<String> getPropertyAsSet(Properties properties,
                             String key)
Returns the values of an multiple value property key as a Set instance, which contains all the values. As the separator character of the values, a space character is used.

Parameters:
properties - The Properties instance, from which to get the multiple values.
key - The key under which the values are stored.
Returns:
A Set instances, containing the values, stored under the property key.

getPropertyAsSet

Set<String> getPropertyAsSet(Properties properties,
                             String key,
                             String separator)
Returns the values of an multiple value property key as a Set instance, which contains all the values.

Parameters:
properties - The Properties instance, from which to get the multiple values.
key - The key under which the values are stored.
separator - The separator used to separate the values. If null is given, the default space ' ' separator is used.
Returns:
An Set instances, containing the values, stored under the property key.

getPropertyAsList

List<String> getPropertyAsList(Properties properties,
                               String key)

getPropertyAsList

List<String> getPropertyAsList(Properties properties,
                               String key,
                               String separator)

toString

String toString(Properties properties)
Creates a String which contains all the property key's and their values, separated by the equals sign '='. Each property is separated by a line separator.

Parameters:
properties -
Returns:

getProperties

Properties getProperties(String baseKey,
                         Properties prop)
Returns a sub set of Properties, which keys start with the baseKey. Creating the Properties instance prop:
 web.proxy.hostname = proxy
 web.proxy.port = 8080
 web.application.name = Web application
 
And using the method getProperties("web.proxy", prop) will return a new Properties instance like this:
 hostname = proxy
 port = 8080
 

Parameters:
baseKey - The key under which the sub set Properties are stored.
prop - The Properties from which the sub set is extracted.
Returns:

getProperties

Properties getProperties(Class<?> clazz,
                         Properties prop)

addProperties

Properties addProperties(Properties prop,
                         String baseKey,
                         Properties extraProp)

addProperties

Properties addProperties(Properties prop,
                         Class<?> clazz,
                         Properties extraProp)

getPropertiesList

List<Properties> getPropertiesList(Properties prop,
                                   String listPrefixKey)

getPropertiesList

List<Properties> getPropertiesList(Properties prop,
                                   String listPrefixKey,
                                   String openingBracket,
                                   String closingBracket)

getPropertiesMap

Map<String,Properties> getPropertiesMap(Properties prop,
                                        String mapPrefixKey)

getPropertiesMap

Map<String,Properties> getPropertiesMap(Properties prop,
                                        String mapPrefixKey,
                                        String openingBracket,
                                        String closingBracket)
 person[tjeerd].name = Mickey Mouse
 person[tjeerd].mobile = +31.6.1111 1111
 person[esther].name = Donald Duck
 person[estehr].mobile = +31.6.1111 2222
 
 person(01).name = Mickey Mouse
 person(01).mobile = +31.6.1111 1111
 person(02).name = Donald Duck
 person(02).mobile = +31.6.1111 2222
 

Parameters:
prop -
mapPrefixKey -
openingBracket -
closingBracket -
Returns:


Copyright © 2013 Verhagen Software. All Rights Reserved.