biz.hammurapi.config
Class PropertyParser

java.lang.Object
  extended by biz.hammurapi.config.PropertyParser

public class PropertyParser
extends java.lang.Object

Expands property value entries like ${myProperty} to property values. Nested properties are supportd, i.e. if myProperty value contains ${someOtherPropery} then it will also be expanded. ${ escaping is not supported.

Version:
$Revision: 1.3 $
Author:
Pavel Vlasov

Field Summary
static java.lang.String TOKEN_CLOSING_CHAR
           
static java.lang.String TOKEN_FIRST_OPENING_CHAR
           
static java.lang.String TOKEN_SECOND_OPENING_CHAR
           
 
Constructor Summary
PropertyParser(boolean useNameAsDefault)
          Creates a new instance of PropertyParser with system properties.
PropertyParser(boolean useNameAsDefault, char tokenFirstOpeningChar, char tokenSecondOpeningChar, char tokenClosingChar)
          Creates a new instance of PropertyParser with system properties.
PropertyParser(Context context, boolean useNameAsDefault)
          Creates a new instance of PropertyParser
PropertyParser(Context context, boolean useNameAsDefault, char tokenFirstOpeningChar, char tokenSecondOpeningChar, char tokenClosingChar)
          Creates a new instance of PropertyParser
 
Method Summary
 java.lang.String getParsedProperty(java.lang.String key)
          Property parsing.
 java.lang.String parse(java.lang.String str)
          Parses a string by replacing occurences of ${<property name>} with property values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOKEN_CLOSING_CHAR

public static final java.lang.String TOKEN_CLOSING_CHAR
See Also:
Constant Field Values

TOKEN_SECOND_OPENING_CHAR

public static final java.lang.String TOKEN_SECOND_OPENING_CHAR
See Also:
Constant Field Values

TOKEN_FIRST_OPENING_CHAR

public static final java.lang.String TOKEN_FIRST_OPENING_CHAR
See Also:
Constant Field Values
Constructor Detail

PropertyParser

public PropertyParser(boolean useNameAsDefault)
Creates a new instance of PropertyParser with system properties.

Parameters:
useNameAsDefault - If true then property name will be used as property default value.

PropertyParser

public PropertyParser(Context context,
                      boolean useNameAsDefault)
Creates a new instance of PropertyParser

Parameters:
properties - Properties
useNameAsDefault - If true then property name will be used as property default value.

PropertyParser

public PropertyParser(boolean useNameAsDefault,
                      char tokenFirstOpeningChar,
                      char tokenSecondOpeningChar,
                      char tokenClosingChar)
Creates a new instance of PropertyParser with system properties.

Parameters:
useNameAsDefault - If true then property name will be used as property default value.

PropertyParser

public PropertyParser(Context context,
                      boolean useNameAsDefault,
                      char tokenFirstOpeningChar,
                      char tokenSecondOpeningChar,
                      char tokenClosingChar)
Creates a new instance of PropertyParser

Parameters:
properties - Properties
useNameAsDefault - If true then property name will be used as property default value.
Method Detail

getParsedProperty

public java.lang.String getParsedProperty(java.lang.String key)
Property parsing. Replaces string ${<property name>} with property value. If property value contains ${<other property name>} it will be parsed.


parse

public java.lang.String parse(java.lang.String str)
Parses a string by replacing occurences of ${<property name>} with property values. If property value contains ${<other property name>} it will be parsed.



Copyright © 2003 Hammurapi Group. All Rights Reserved.