nl.knowledgeplaza.util
Class Properties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by nl.knowledgeplaza.util.Properties
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class Properties
extends Properties

See Also:
Serialized Form

Field Summary
static String ID_APPLICATION
           
static String ID_OS
           
static String ID_SYSTEM
           
static String ID_USER
           
static String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
static String SYSTEMPROPERTY_APPLICATION
           
static String SYSTEMPROPERTY_OS
           
static String SYSTEMPROPERTY_SYSTEM
           
static String SYSTEMPROPERTY_USER
           
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
Properties()
          get all the settings from the system properties
Properties(Map identifiers)
          get all the settings from the system properties then override with provided identifiers
 
Method Summary
 Enumeration coreKeys()
          getCoreKeys with an enumarator to mimick keys()
 Properties getCollection(String prefix)
          Fetch all properties that have a certain prefix.
 List getCoreKeys()
          Return a list with all keys without the conditions
 Map getGroupedCollection(String prefix)
          Get all properties that match a prefix and group them.
 String getIdentifier(String key)
           
 Map getIdentifiers()
           
 String getProperty(String name)
          Get a property value If there are multiple conditional properties for the same key, fetch the one with the highest condition match.
 void setIdentifier(String key, String value)
           
 void setIdentifiers(Map<String,String> identifiers)
           
 
Methods inherited from class java.util.Properties
getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, storeToXML, storeToXML
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SOURCECODE_VERSION

public static final String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values

SYSTEMPROPERTY_APPLICATION

public static String SYSTEMPROPERTY_APPLICATION

ID_APPLICATION

public static String ID_APPLICATION

SYSTEMPROPERTY_SYSTEM

public static String SYSTEMPROPERTY_SYSTEM

ID_SYSTEM

public static String ID_SYSTEM

SYSTEMPROPERTY_USER

public static String SYSTEMPROPERTY_USER

ID_USER

public static String ID_USER

SYSTEMPROPERTY_OS

public static String SYSTEMPROPERTY_OS

ID_OS

public static String ID_OS
Constructor Detail

Properties

public Properties()
get all the settings from the system properties


Properties

public Properties(Map identifiers)
get all the settings from the system properties then override with provided identifiers

Method Detail

getIdentifier

public String getIdentifier(String key)

setIdentifier

public void setIdentifier(String key,
                          String value)

getIdentifiers

public Map getIdentifiers()

setIdentifiers

public void setIdentifiers(Map<String,String> identifiers)

getCoreKeys

public List getCoreKeys()
Return a list with all keys without the conditions


coreKeys

public Enumeration coreKeys()
getCoreKeys with an enumarator to mimick keys()

Returns:

getProperty

public String getProperty(String name)
Get a property value If there are multiple conditional properties for the same key, fetch the one with the highest condition match.

Overrides:
getProperty in class Properties

getCollection

public Properties getCollection(String prefix)
Fetch all properties that have a certain prefix. If there are multiple conditional properties for the same key, fetch the one with the highest condition match.

Parameters:
prefix -
Returns:

getGroupedCollection

public Map getGroupedCollection(String prefix)
Get all properties that match a prefix and group them. For example: my.collection.1.f.1=A1 my.collection.1.f.2=B1 my.collection.1.f.3=C1 my.collection.3.f.1=A3 my.collection.3.f.2=B3 my.collection.3.f.3=C3 Calling this method with prefix my.collection, returns a map with under the key "1" and "3" two maps containing "f.1" with their respective values. So the result is: [1=>[f.1=>A1, f.3=>C1, f.2=>B1], 3=>[f.1=>A3, f.3=>C3, f.2=>B3]] Often de index is not relevant, but having it in a map makes it a bit of a hassle to navigate (pre 1.5) Using " list.addAll(map.values()); " makes it easier.

Parameters:
prefix -
Returns:


Copyright © 2012 KnowledgePlaza. All Rights Reserved.