|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.argval.utils.impl.PropertiesUtilImpl
public class PropertiesUtilImpl
Utility class for the Properties
class.
Field Summary |
---|
Fields inherited from interface net.sourceforge.argval.utils.PropertiesUtil |
---|
PROP_SEP |
Constructor Summary | |
---|---|
PropertiesUtilImpl()
|
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 '='. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PropertiesUtilImpl()
Method Detail |
---|
public String createKey(String key, String keyPart)
PropertiesUtil
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"
.
createKey
in interface PropertiesUtil
key
- The existing key
, to which the keyPart
is added.keyPart
- The key part to add.
public String createKey(String key, String firstKeyPart, String secondKeyPart)
PropertiesUtil
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"
.
createKey
in interface PropertiesUtil
key
- The existing key
, to which the keyPart
's are added.firstKeyPart
- The key part to add.secondKeyPart
- The key part to add.
PropertiesUtil.createKey(String, String)
public String createKey(String[] keyArray)
PropertiesUtil
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"
.
createKey
in interface PropertiesUtil
keyArray
- An array of key parts which need to be concatinated.
public Properties loadProperties(File propertyFile)
loadProperties
in interface PropertiesUtil
public Set<String> getPropertyAsSet(Properties properties, String key)
PropertiesUtil
getPropertyAsSet
in interface PropertiesUtil
properties
- The Properties instance, from which to get the multiple values.key
- The key under which the values are stored.
public Set<String> getPropertyAsSet(Properties properties, String key, String separator)
PropertiesUtil
getPropertyAsSet
in interface PropertiesUtil
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.
public List<String> getPropertyAsList(Properties properties, String key)
getPropertyAsList
in interface PropertiesUtil
public List<String> getPropertyAsList(Properties properties, String key, String separator)
getPropertyAsList
in interface PropertiesUtil
public String toString(Properties properties)
PropertiesUtil
toString
in interface PropertiesUtil
public Properties getProperties(String baseKey, Properties prop)
PropertiesUtil
Properties
, which keys start with the baseKey.
Creating the Properties
instance prop
:
web.proxy.hostname = proxy web.proxy.port = 8080 web.application.name = Web applicationAnd using the method
getProperties("web.proxy", prop)
will return a new Properties instance
like this:
hostname = proxy port = 8080
getProperties
in interface PropertiesUtil
baseKey
- The key under which the sub set Properties are stored.prop
- The Properties from which the sub set is extracted.
public Properties getProperties(Class<?> clazz, Properties prop)
getProperties
in interface PropertiesUtil
public Properties addProperties(Properties prop, String baseKey, Properties extraProp)
addProperties
in interface PropertiesUtil
public Properties addProperties(Properties prop, Class<?> clazz, Properties extraProp)
addProperties
in interface PropertiesUtil
public List<Properties> getPropertiesList(Properties prop, String listPrefixKey)
getPropertiesList
in interface PropertiesUtil
public List<Properties> getPropertiesList(Properties prop, String listPrefixKey, String openingBracket, String closingBracket)
getPropertiesList
in interface PropertiesUtil
public Map<String,Properties> getPropertiesMap(Properties prop, String mapPrefixKey)
getPropertiesMap
in interface PropertiesUtil
public Map<String,Properties> getPropertiesMap(Properties prop, String mapPrefixKey, String openingBracket, String closingBracket)
PropertiesUtil
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
getPropertiesMap
in interface PropertiesUtil
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |