junit.extensions.util
Class EnhancedProperties

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--java.util.Properties
                    |
                    +--junit.extensions.util.EnhancedProperties
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class EnhancedProperties
extends java.util.Properties

Enhanced properties. Provides flexible scheme of keys naming.
Property name may be defined by base object (it's class name), some modifier and short key.
Search order for keys resolution:

Author:
Siegfried GOESCHL, Dima STADNIK
See Also:
Serialized Form

Inner classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
static char SEPARATOR
          Intermediate character that is used to construct properties keys.
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
EnhancedProperties()
           
 
Method Summary
 boolean containsKeys(java.lang.String key)
          Checks whether underlying properties contains key of properties array.
 java.lang.String[] getProperties(java.lang.Object base, java.lang.String modifier, java.lang.String key)
          Retrieves property that is represented by array of strings.
 java.lang.String[] getProperties(java.lang.String key)
          Retrieves properties array.
protected  java.lang.String getPropertiesKey(java.lang.Object base, java.lang.String modifier, java.lang.String key)
          Generates base of properties key.
 java.lang.String getProperty(java.lang.Object base, java.lang.String modifier, java.lang.String key)
          Retrieves single property.
protected  java.lang.String getPropertyKey(java.lang.Object base, java.lang.String modifier, java.lang.String key)
          Generates property key.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, propertyNames, save, setProperty, store
 
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

SEPARATOR

public static final char SEPARATOR
Intermediate character that is used to construct properties keys.
Constructor Detail

EnhancedProperties

public EnhancedProperties()
Method Detail

getProperty

public java.lang.String getProperty(java.lang.Object base,
                                    java.lang.String modifier,
                                    java.lang.String key)
Retrieves single property.
Parameters:
base - Base object.
modifier - Property key modifier.
key - Property key.
Returns:
Property value.

getProperties

public java.lang.String[] getProperties(java.lang.Object base,
                                        java.lang.String modifier,
                                        java.lang.String key)
Retrieves property that is represented by array of strings.
Parameters:
base - Base object.
modifier - Property key modifier.
key - Property key.
Returns:
Property value.

getPropertyKey

protected java.lang.String getPropertyKey(java.lang.Object base,
                                          java.lang.String modifier,
                                          java.lang.String key)
Generates property key.
Parameters:
base - Base object.
modifier - Property key modifier.
key - Property key.
Returns:
Key in underlying properties file or null if there is no such key.

getPropertiesKey

protected java.lang.String getPropertiesKey(java.lang.Object base,
                                            java.lang.String modifier,
                                            java.lang.String key)
Generates base of properties key.
Parameters:
base - Base object.
modifier - Property key modifier.
key - Property key.
Returns:
Base part of key for properties array in underlying properties file or null if there is no such key.

containsKeys

public boolean containsKeys(java.lang.String key)
Checks whether underlying properties contains key of properties array.
Parameters:
key - Key in underlying properties.
Returns:
true if key exists.

getProperties

public java.lang.String[] getProperties(java.lang.String key)
Retrieves properties array.
Parameters:
key - Base key for properties array.
Returns:
Properties array.


Copyright © 2001-2002 IT20one GmbH. All Rights Reserved.