Top Description Fields Constructors Methods
org.glassfish.grizzly.http.server.util

public final Class ParameterMap

extends LinkedHashMap<String, String[]>
Class Inheritance
Imports
java.util.LinkedHashMap, .Map

Extended implementation of LinkedHashMap that includes a locked property. This class can be used to safely expose Catalina internal parameter map objects to user classes without having to clone them in order to avoid modifications. When first created, a ParameterMap instance is not locked.
Author
Craig R. McClanahan
Version
$Revision: 1.4 $ $Date: 2007/06/18 17:41:35 $

Field Summary

Modifier and TypeField and Description
private boolean
locked

The current lock state of this parameter map.

Constructor Summary

AccessConstructor and Description
public
ParameterMap()

Construct a new, empty map with the default initial capacity and load factor.

public
ParameterMap(int
The initial capacity of this map
initialCapacity
)

Construct a new, empty map with the specified initial capacity and default load factor.

public
ParameterMap(int
The initial capacity of this map
initialCapacity
,
float
The load factor of this map
loadFactor
)

Construct a new, empty map with the specified initial capacity and load factor.

public
ParameterMap(Map<String, String[]>
Map whose contents are duplicated in the new map
map
)

Construct a new map with the same mappings as the given map.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Overrides java.util.LinkedHashMap.clear.

Implements java.util.Map.clear.

Remove all mappings from this map.

public boolean
isLocked()

Return the locked state of this parameter map.

public String[]

Returns:

The previous value associated with the specified key, or null if there was no mapping for key
put
(String
Key with which the specified value is to be associated
key
,
String[]
Value to be associated with the specified key
value
)

Overrides java.util.HashMap.put.

Implements java.util.Map.put.

Associate the specified value with the specified key in this map.

public void
putAll(Map<K, V>
Mappings to be stored into this map
map
)

Overrides java.util.HashMap.putAll.

Implements java.util.Map.putAll.

Copy all of the mappings from the specified map to this one.

public Object

Returns:

The previous value associated with the specified key, or null if there was no mapping for that key
remove
(String
Key whose mapping is to be removed from the map
key
)

Remove the mapping for this key from the map if present.

public void
setLocked(boolean
The new locked state
locked
)

Set the locked state of this parameter map.

Inherited from java.util.LinkedHashMap:
containsValueentrySetforEachgetgetOrDefaultkeySetnewLinkedHashMapputFirstputLastremoveEldestEntryreplaceAllreversedsequencedEntrySetsequencedKeySetsequencedValuesvalues

Field Detail

lockedback to summary
private boolean locked

The current lock state of this parameter map.

Constructor Detail

ParameterMapback to summary
public ParameterMap()

Construct a new, empty map with the default initial capacity and load factor.

ParameterMapback to summary
public ParameterMap(int initialCapacity)

Construct a new, empty map with the specified initial capacity and default load factor.

Parameters
initialCapacity:int

The initial capacity of this map

ParameterMapback to summary
public ParameterMap(int initialCapacity, float loadFactor)

Construct a new, empty map with the specified initial capacity and load factor.

Parameters
initialCapacity:int

The initial capacity of this map

loadFactor:float

The load factor of this map

ParameterMapback to summary
public ParameterMap(Map<String, String[]> map)

Construct a new map with the same mappings as the given map.

Parameters
map:Map<String, String[]>

Map whose contents are duplicated in the new map

Method Detail

clearback to summary
public void clear()

Overrides java.util.LinkedHashMap.clear.

Implements java.util.Map.clear.

Remove all mappings from this map.

Annotations
@Override
Exceptions
IllegalStateException:
if this map is currently locked
isLockedback to summary
public boolean isLocked()

Return the locked state of this parameter map.

putback to summary
public String[] put(String key, String[] value)

Overrides java.util.HashMap.put.

Implements java.util.Map.put.

Associate the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced.

Parameters
key:String

Key with which the specified value is to be associated

value:String[]

Value to be associated with the specified key

Returns:String[]

The previous value associated with the specified key, or null if there was no mapping for key

Annotations
@Override
Exceptions
IllegalStateException:
if this map is currently locked
putAllback to summary
public void putAll(Map<K, V> map)

Overrides java.util.HashMap.putAll.

Implements java.util.Map.putAll.

Copy all of the mappings from the specified map to this one. These mappings replace any mappings that this map had for any of the keys currently in the specified Map.

Parameters
map:Map<K, V>

Mappings to be stored into this map

Annotations
@Override
@SuppressWarnings:unchecked
Exceptions
IllegalStateException:
if this map is currently locked
removeback to summary
public Object remove(String key)

Remove the mapping for this key from the map if present.

Parameters
key:String

Key whose mapping is to be removed from the map

Returns:Object

The previous value associated with the specified key, or null if there was no mapping for that key

Exceptions
IllegalStateException:
if this map is currently locked
setLockedback to summary
public void setLocked(boolean locked)

Set the locked state of this parameter map.

Parameters
locked:boolean

The new locked state