FileDocCategorySizeDatePackage
ComponentConfiguration.javaAPI DocApache Lucene 2.1.02827Wed Feb 14 10:46:06 GMT 2007org.apache.lucene.gdata.server.registry.configuration

ComponentConfiguration

public class ComponentConfiguration extends Object
Simple configuration class storing properties as key with defined property values as values in a Map. As a map cannot contain duplicate keys the first use of a key can not be replaced. If a key is used twice a {@link java.lang.IllegalArgumentException} will be thrown.
see
Map
author
Simon Willnauer

Fields Summary
private final Map
configMap
Constructors Summary
public ComponentConfiguration()
Creates a new ComponentConfiguration object and initializes the internal map.

        super();
        this.configMap = new HashMap<String, String>();
    
Methods Summary
public booleancontains(java.lang.String key)

param
key - a string key
return
- true if the key is set, otherwise false
see
Map#containsKey(java.lang.Object)

        return this.configMap.containsKey(key);
    
public java.lang.Stringget(java.lang.String key)
Returns the value of the key or null if the key is not set.

param
key - the key
return
- the value for the key or null if the key is not set.
see
Map#get(java.lang.Object)

        return this.configMap.get(key);
    
public voidset(java.lang.String key, java.lang.String value)
Stores a key / value pair as a property. If a key is used twice the first call will set the key / value pair. Any subsequent calls with a already set key will throw a IllegalArgumentException.

param
key - the property as a key
param
value - the value for the key
see
Map#put(Object, Object)

        if (this.configMap.containsKey(key))
            throw new IllegalArgumentException("key has already been used");
        this.configMap.put(key, value);