nl.knowledgeplaza.util
Class Properties

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

public class Properties
extends java.util.Properties

See Also:
Serialized Form

Field Summary
static java.lang.String ID_APPLICATION
           
static java.lang.String ID_OS
           
static java.lang.String ID_SYSTEM
           
static java.lang.String ID_USER
           
static java.lang.String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
static java.lang.String SYSTEMPROPERTY_APPLICATION
           
static java.lang.String SYSTEMPROPERTY_OS
           
static java.lang.String SYSTEMPROPERTY_SYSTEM
           
static java.lang.String SYSTEMPROPERTY_USER
           
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
Properties()
          get all the settings from the system properties
Properties(java.util.Map identifiers)
          get all the settings from the system properties then override with provided identifiers
 
Method Summary
 java.util.Enumeration coreKeys()
          getCoreKeys with an enumarator to mimick keys()
 Properties getCollection(java.lang.String prefix)
          Fetch all properties that have a certain prefix.
 java.util.List getCoreKeys()
          Return a list with all keys without the conditions
 java.util.Map getGroupedCollection(java.lang.String prefix)
          Get all properties that match a prefix and group them.
 java.lang.String getIdentifier(java.lang.String key)
           
 java.util.Map getIdentifiers()
           
 java.lang.String getProperty(java.lang.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(java.lang.String key, java.lang.String value)
           
 void setIdentifiers(java.util.Map<java.lang.String,java.lang.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 java.lang.String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values

SYSTEMPROPERTY_APPLICATION

public static java.lang.String SYSTEMPROPERTY_APPLICATION

ID_APPLICATION

public static java.lang.String ID_APPLICATION

SYSTEMPROPERTY_SYSTEM

public static java.lang.String SYSTEMPROPERTY_SYSTEM

ID_SYSTEM

public static java.lang.String ID_SYSTEM

SYSTEMPROPERTY_USER

public static java.lang.String SYSTEMPROPERTY_USER

ID_USER

public static java.lang.String ID_USER

SYSTEMPROPERTY_OS

public static java.lang.String SYSTEMPROPERTY_OS

ID_OS

public static java.lang.String ID_OS
Constructor Detail

Properties

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


Properties

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

Method Detail

getIdentifier

public java.lang.String getIdentifier(java.lang.String key)

setIdentifier

public void setIdentifier(java.lang.String key,
                          java.lang.String value)

getIdentifiers

public java.util.Map getIdentifiers()

setIdentifiers

public void setIdentifiers(java.util.Map<java.lang.String,java.lang.String> identifiers)

getCoreKeys

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


coreKeys

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

Returns:

getProperty

public java.lang.String getProperty(java.lang.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 java.util.Properties

getCollection

public Properties getCollection(java.lang.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 java.util.Map getGroupedCollection(java.lang.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 © 2010. All Rights Reserved.