com.cc.framework.util
Class PropertyMap

java.lang.Object
  extended bycom.cc.framework.util.PropertyMap

public class PropertyMap
extends java.lang.Object

This class is responsible for converting property maps to and from String

Version:
$Revision: 1.10 $
Author:
Harald Schulz

Field Summary
private  java.util.HashMap properties
          Properties collection.
 
Constructor Summary
PropertyMap()
           
 
Method Summary
private  void addInternal(java.lang.String key, java.lang.Object value)
          Adds a key value pair to the property map
 void addProperty(java.lang.String key, java.lang.String value)
          Adds a property of type String to the map
 void addProperty(java.lang.String key, java.lang.String[] values)
          Adds an Array of Strings to the map
private static java.lang.String decode(java.lang.String encodedStr)
          translate all escaped characters into the raw characters
private static java.lang.String encode(java.lang.String rawStr)
          replace all occurrences of '=', ',' and ';' with escaped characters
 java.lang.String[] getProperties(java.lang.String key)
          Retrieves the property for the given key in array form
 java.lang.String getProperty(java.lang.String key)
          Retrieves the property for the given key
 boolean hasProperty(java.lang.String key)
          Checks if the map contains the given key
static PropertyMap parse(java.lang.String str)
          Converts a String into a PropertyMap Object
 java.lang.String toString()
          Converts the PropertyMap into a String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

properties

private java.util.HashMap properties
Properties collection. The value objects are of type String or Array of String

Constructor Detail

PropertyMap

public PropertyMap()
Method Detail

addInternal

private void addInternal(java.lang.String key,
                         java.lang.Object value)
Adds a key value pair to the property map

Parameters:
key - Property Key
value - Value

addProperty

public void addProperty(java.lang.String key,
                        java.lang.String value)
Adds a property of type String to the map

Parameters:
key - Property Key
value - Value

addProperty

public void addProperty(java.lang.String key,
                        java.lang.String[] values)
Adds an Array of Strings to the map

Parameters:
key - Property Key
values - Value Array

hasProperty

public boolean hasProperty(java.lang.String key)
Checks if the map contains the given key

Parameters:
key - Property Key
Returns:
true if the key is a member of the property map

getProperty

public java.lang.String getProperty(java.lang.String key)
Retrieves the property for the given key

Parameters:
key - Property Key
Returns:
Value or null

getProperties

public java.lang.String[] getProperties(java.lang.String key)
Retrieves the property for the given key in array form

Parameters:
key - Property Key
Returns:
Array of values or null

decode

private static java.lang.String decode(java.lang.String encodedStr)
translate all escaped characters into the raw characters

Parameters:
encodedStr - the encoded string
Returns:
raw string

encode

private static java.lang.String encode(java.lang.String rawStr)
replace all occurrences of '=', ',' and ';' with escaped characters

Parameters:
rawStr - the raw string to encode
Returns:
encoded string

parse

public static PropertyMap parse(java.lang.String str)
Converts a String into a PropertyMap Object

Parameters:
str - The String to convert
Returns:
PropertyMap or null

toString

public java.lang.String toString()
Converts the PropertyMap into a String

See Also:
Object.toString()


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.