org.glite.security.util
Class CaseInsensitiveProperties

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 org.glite.security.util.CaseInsensitiveProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public class CaseInsensitiveProperties
extends java.util.Properties

Case insensitive version of Properties class. All keys are lowercased when used.

Author:
Joni Hahkala Created on July 25, 2002, 10:56 PM
See Also:
Properties, Serialized Form

Constructor Summary
CaseInsensitiveProperties()
          Creates a new instance of CaseInsensitiveProperties.
CaseInsensitiveProperties(java.util.Properties defaults)
          Creates a new instance of CaseInsensitiveProperties.
 
Method Summary
 boolean containsKey(java.lang.String key)
          Checks whether the key exists in the storage.
 java.lang.String get(java.lang.String key)
          Gets the string stored under the given key.
 java.lang.String getProperty(java.lang.String key)
           
 java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
           
 void load(java.io.InputStream inputStream)
          Loads the properties from the stream inputStream.
 void loadProperties(java.util.Properties inProperties)
          Loads the properties from inProperties into this instance.
 java.lang.Object put(java.lang.String key, java.lang.String value)
          Puts a String in to the property storage case insensitivitizing it.
 void putAll(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> t)
           
 java.lang.Object remove(java.lang.Object keyObj)
           
 java.lang.Object setProperty(java.lang.String key, java.lang.String value)
           
 
Methods inherited from class java.util.Properties
list, list, load, loadFromXML, propertyNames, save, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, size, toString, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CaseInsensitiveProperties

public CaseInsensitiveProperties(java.util.Properties defaults)
Creates a new instance of CaseInsensitiveProperties.

Parameters:
defaults - the default values to set.

CaseInsensitiveProperties

public CaseInsensitiveProperties()
Creates a new instance of CaseInsensitiveProperties.

Method Detail

getProperty

public java.lang.String getProperty(java.lang.String key)
Overrides:
getProperty in class java.util.Properties

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defaultValue)
Overrides:
getProperty in class java.util.Properties

setProperty

public java.lang.Object setProperty(java.lang.String key,
                                    java.lang.String value)
Overrides:
setProperty in class java.util.Properties

load

public void load(java.io.InputStream inputStream)
          throws java.io.IOException
Loads the properties from the stream inputStream.

Overrides:
load in class java.util.Properties
Throws:
java.io.IOException
See Also:
Properties.load(java.io.InputStream)

loadProperties

public void loadProperties(java.util.Properties inProperties)
Loads the properties from inProperties into this instance. The defaults from inProperties are loaded first and the non-default properties are set after that. Thus default setting (Key1=value1) is overridden with non-default setting (key1=value2).

Parameters:
inProperties - the properties to load.

remove

public java.lang.Object remove(java.lang.Object keyObj)
                        throws java.lang.IllegalArgumentException
Specified by:
remove in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
remove in class java.util.Hashtable<java.lang.Object,java.lang.Object>
Throws:
java.lang.IllegalArgumentException
See Also:
This implementation only accepts strings as keys, if other than String is used, an exception is thrown.

put

public java.lang.Object put(java.lang.String key,
                            java.lang.String value)
Puts a String in to the property storage case insensitivitizing it.

Parameters:
key - The key to store the key under.
value - The value to store.
Returns:
The previous value stored under this key, null if there wasn't one.

get

public java.lang.String get(java.lang.String key)
Gets the string stored under the given key.

Parameters:
key - The key to use to get the value.
Returns:
The value if there was one, null otherwise.

containsKey

public boolean containsKey(java.lang.String key)
Checks whether the key exists in the storage.

Parameters:
key - the key to search for.
Returns:
true if key is used, false if not.

putAll

public void putAll(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> t)
Specified by:
putAll in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
putAll in class java.util.Hashtable<java.lang.Object,java.lang.Object>