org.apache.wicket.util.value
Interface IValueMap

All Superinterfaces:
java.util.Map
All Known Implementing Classes:
AttributeMap, CopyOnWriteValueMap, PageParameters, ValueMap

public interface IValueMap
extends java.util.Map

A Map interface that holds values, parses Strings, and exposes a variety of convenience methods.

Since:
1.2.6
Author:
Johan Compagner

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Method Summary
 void clear()
           
 boolean getBoolean(java.lang.String key)
          Retrieves a boolean value by key.
 java.lang.CharSequence getCharSequence(java.lang.String key)
          Retrieves a CharSequence by key.
 double getDouble(java.lang.String key)
          Retrieves a double value by key.
 double getDouble(java.lang.String key, double defaultValue)
          Retrieves a double value by key, using a default value if not found.
 Duration getDuration(java.lang.String key)
          Retrieves a Duration by key.
 int getInt(java.lang.String key)
          Retrieves an int value by key.
 int getInt(java.lang.String key, int defaultValue)
          Retrieves an int value by key, using a default value if not found.
 java.lang.String getKey(java.lang.String key)
          Provided that the hash key is a String and you need to access the value ignoring the key's case (upper- or lowercase letters), then you may use this method to get the correct writing.
 long getLong(java.lang.String key)
          Retrieves a long value by key.
 long getLong(java.lang.String key, long defaultValue)
          Retrieves a long value by key, using a default value if not found.
 java.lang.String getString(java.lang.String key)
          Retrieves a String by key.
 java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
          Retrieves a String by key, using a default value if not found.
 java.lang.String[] getStringArray(java.lang.String key)
          Retrieves a String array by key.
 StringValue getStringValue(java.lang.String key)
          Retrieves a StringValue object by key.
 Time getTime(java.lang.String key)
          Retrieves a Time object by key.
 boolean isImmutable()
          Returns whether or not this IValueMap is immutable.
 IValueMap makeImmutable()
          Makes this IValueMap immutable by changing the underlying map representation to a Collections.unmodifiableMap.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map map)
           
 java.lang.Object remove(java.lang.Object key)
           
 
Methods inherited from interface java.util.Map
containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, size, values
 

Method Detail

clear

void clear()
Specified by:
clear in interface java.util.Map
See Also:
Map.clear()

getBoolean

boolean getBoolean(java.lang.String key)
                   throws StringValueConversionException
Retrieves a boolean value by key.

Parameters:
key - the key
Returns:
the value
Throws:
StringValueConversionException

getDouble

double getDouble(java.lang.String key)
                 throws StringValueConversionException
Retrieves a double value by key.

Parameters:
key - the key
Returns:
the value
Throws:
StringValueConversionException

getDouble

double getDouble(java.lang.String key,
                 double defaultValue)
                 throws StringValueConversionException
Retrieves a double value by key, using a default value if not found.

Parameters:
key - the key
defaultValue - value to use if no value is in this IValueMap
Returns:
the value
Throws:
StringValueConversionException

getDuration

Duration getDuration(java.lang.String key)
                     throws StringValueConversionException
Retrieves a Duration by key.

Parameters:
key - the key
Returns:
the Duration value
Throws:
StringValueConversionException

getInt

int getInt(java.lang.String key)
           throws StringValueConversionException
Retrieves an int value by key.

Parameters:
key - the key
Returns:
the value
Throws:
StringValueConversionException

getInt

int getInt(java.lang.String key,
           int defaultValue)
           throws StringValueConversionException
Retrieves an int value by key, using a default value if not found.

Parameters:
key - the key
defaultValue - value to use if no value is in this IValueMap
Returns:
the value
Throws:
StringValueConversionException

getLong

long getLong(java.lang.String key)
             throws StringValueConversionException
Retrieves a long value by key.

Parameters:
key - the key
Returns:
the value
Throws:
StringValueConversionException

getLong

long getLong(java.lang.String key,
             long defaultValue)
             throws StringValueConversionException
Retrieves a long value by key, using a default value if not found.

Parameters:
key - the key
defaultValue - value to use if no value in this IValueMap
Returns:
the value
Throws:
StringValueConversionException

getString

java.lang.String getString(java.lang.String key,
                           java.lang.String defaultValue)
Retrieves a String by key, using a default value if not found.

Parameters:
key - the key
defaultValue - default value to return if value is null
Returns:
the String

getString

java.lang.String getString(java.lang.String key)
Retrieves a String by key.

Parameters:
key - the key
Returns:
the String

getCharSequence

java.lang.CharSequence getCharSequence(java.lang.String key)
Retrieves a CharSequence by key.

Parameters:
key - the key
Returns:
the CharSequence

getStringArray

java.lang.String[] getStringArray(java.lang.String key)
Retrieves a String array by key. If the value was a String[] it will be returned directly. If it was a String it will be converted to a String array of length one. If it was an array of another type, a String array will be made and each element will be converted to a String.

Parameters:
key - the key
Returns:
the String array of that key

getStringValue

StringValue getStringValue(java.lang.String key)
Retrieves a StringValue object by key.

Parameters:
key - the key
Returns:
the StringValue object

getTime

Time getTime(java.lang.String key)
             throws StringValueConversionException
Retrieves a Time object by key.

Parameters:
key - the key
Returns:
the Time object
Throws:
StringValueConversionException

isImmutable

boolean isImmutable()
Returns whether or not this IValueMap is immutable.

Returns:
whether or not this IValueMap is immutable

makeImmutable

IValueMap makeImmutable()
Makes this IValueMap immutable by changing the underlying map representation to a Collections.unmodifiableMap. After calling this method, any attempt to modify this IValueMap will result in a RuntimeException being thrown by the Collections framework.

Returns:
this IValueMap

put

java.lang.Object put(java.lang.Object key,
                     java.lang.Object value)
Specified by:
put in interface java.util.Map
See Also:
Map.put(Object, Object)

putAll

void putAll(java.util.Map map)
Specified by:
putAll in interface java.util.Map
See Also:
Map.putAll(java.util.Map)

remove

java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map
See Also:
Map.remove(java.lang.Object)

getKey

java.lang.String getKey(java.lang.String key)
Provided that the hash key is a String and you need to access the value ignoring the key's case (upper- or lowercase letters), then you may use this method to get the correct writing.

Parameters:
key - the key
Returns:
the key with the correct writing


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.