org.clapper.util.misc
Class PropertiesMap
- java.lang.Object
-
- java.util.AbstractMap<java.lang.String,java.lang.String>
-
- org.clapper.util.misc.PropertiesMap
-
- All Implemented Interfaces:
- java.io.Serializable, java.util.Map<java.lang.String,java.lang.String>
public class PropertiesMap extends java.util.AbstractMap<java.lang.String,java.lang.String> implements java.io.SerializableAn PropertiesMap provides a thin Map<String,String> wrapper around a java.util.Properties object, allowing the Properties object to be used where a type-safe Map is expected. (One such place is with aVariableSubstituterclass.)- See Also:
Properties, Serialized Form
-
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor and Description PropertiesMap(java.util.Properties properties)Construct a map to wrap the specified Properties object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclear()Remove all mappings from this map.booleancontainsKey(java.lang.Object key)Determine whether this map contains a mapping for a given key.booleancontainsValue(java.lang.Object value)Determine whether this map contains a given value.java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>>entrySet()Get a set view of the mappings in this map.java.lang.Stringget(java.lang.Object key)Retrieve an object from the map.booleanisEmpty()Determine whether this map is empty or not.java.util.Set<java.lang.String>keySet()Return a Set view of the keys in the map.java.lang.Stringput(java.lang.String key, java.lang.String value)Associates the specified value with the specified key in this map.java.lang.Stringremove(java.lang.Object key)Removes the mapping for a key, if there is one.intsize()Get the number of entries in the map.
-
-
-
Constructor Detail
-
PropertiesMap
public PropertiesMap(java.util.Properties properties)
Construct a map to wrap the specified Properties object.- Parameters:
properties- the Properties object
-
-
Method Detail
-
clear
public void clear()
Remove all mappings from this map.- Specified by:
clearin interfacejava.util.Map<java.lang.String,java.lang.String>- Overrides:
clearin classjava.util.AbstractMap<java.lang.String,java.lang.String>
-
containsKey
public boolean containsKey(java.lang.Object key)
Determine whether this map contains a mapping for a given key. Note that this implementation of containsKey() does not refresh the object in the cache.- Specified by:
containsKeyin interfacejava.util.Map<java.lang.String,java.lang.String>- Overrides:
containsKeyin classjava.util.AbstractMap<java.lang.String,java.lang.String>- Parameters:
key- the key to find- Returns:
- true if the key is in the map, false if not
-
containsValue
public boolean containsValue(java.lang.Object value)
Determine whether this map contains a given value. Note that this implementation of containsValue() does not refresh the objects in the cache.- Specified by:
containsValuein interfacejava.util.Map<java.lang.String,java.lang.String>- Overrides:
containsValuein classjava.util.AbstractMap<java.lang.String,java.lang.String>- Parameters:
value- the value to find- Returns:
- true if the value is in the map, false if not
-
entrySet
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> entrySet()
Get a set view of the mappings in this map. Each element in this set is a Map.Entry. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. The collection supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Collection.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.- Specified by:
entrySetin interfacejava.util.Map<java.lang.String,java.lang.String>- Specified by:
entrySetin classjava.util.AbstractMap<java.lang.String,java.lang.String>- Returns:
- nothing
- Throws:
java.lang.UnsupportedOperationException- unconditionally
-
get
public java.lang.String get(java.lang.Object key)
Retrieve an object from the map. Retrieving an object from an LRU map "refreshes" the object so that it is among the most recently used objects.- Specified by:
getin interfacejava.util.Map<java.lang.String,java.lang.String>- Overrides:
getin classjava.util.AbstractMap<java.lang.String,java.lang.String>- Parameters:
key- the object's key in the map. Must be a string.- Returns:
- the associated object, or null if not found
- Throws:
java.lang.ClassCastException- if key is not a string
-
isEmpty
public boolean isEmpty()
Determine whether this map is empty or not.- Specified by:
isEmptyin interfacejava.util.Map<java.lang.String,java.lang.String>- Overrides:
isEmptyin classjava.util.AbstractMap<java.lang.String,java.lang.String>- Returns:
- true if the map has no mappings, false otherwise
-
keySet
public java.util.Set<java.lang.String> keySet()
Return a Set view of the keys in the map. The set is partially backed by the map. Changes to the map are not necessarily reflected in the set, and vice-versa. The set does not support element removal.
- Specified by:
keySetin interfacejava.util.Map<java.lang.String,java.lang.String>- Overrides:
keySetin classjava.util.AbstractMap<java.lang.String,java.lang.String>- Returns:
- the set of keys in this map
-
put
public java.lang.String put(java.lang.String key, java.lang.String value)Associates the specified value with the specified key in this map. If the key already has a value in this map, the existing value is replaced by the new value, and the old value is replaced. If the key already exists in the map, it is moved to the end of the key insertion order list.- Specified by:
putin interfacejava.util.Map<java.lang.String,java.lang.String>- Overrides:
putin classjava.util.AbstractMap<java.lang.String,java.lang.String>- Parameters:
key- the key with which the specified value is to be associatedvalue- the value to associate with the specified key- Returns:
- the previous value associated with the key, or null if (a) there was no previous value, or (b) the previous value was a null
-
remove
public java.lang.String remove(java.lang.Object key)
Removes the mapping for a key, if there is one. Not supported by this class.- Specified by:
removein interfacejava.util.Map<java.lang.String,java.lang.String>- Overrides:
removein classjava.util.AbstractMap<java.lang.String,java.lang.String>- Parameters:
key- the key to remove- Returns:
- the previous value associated with the key, or null if (a) there was no previous value, or (b) the previous value was a null
- Throws:
java.lang.UnsupportedOperationException- unconditionally
-
size
public int size()
Get the number of entries in the map. Note that this value can temporarily exceed the maximum capacity of the map. See the class documentation for details.- Specified by:
sizein interfacejava.util.Map<java.lang.String,java.lang.String>- Overrides:
sizein classjava.util.AbstractMap<java.lang.String,java.lang.String>- Returns:
- the number of entries in the map
-
-
DMelt 3.0 © DataMelt by jWork.ORG