org.utgenome.gwt.utgb.client.util
Class Properties

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<String,String>
          extended by org.utgenome.gwt.utgb.client.util.Properties
All Implemented Interfaces:
Serializable, Cloneable, Map<String,String>

public class Properties
extends HashMap<String,String>

This class is an wrapper of the HashMap, which makes easier to convert associated values with keys into primitive types, such as int, boolean, String etc.

Author:
leo
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
Properties()
           
Properties(Map<String,String> property)
           
 
Method Summary
 void add(String key, boolean value)
           
 void add(String key, float value)
           
 void add(String key, int value)
           
 void add(String key, long value)
           
 void add(String key, String value)
           
 String get(String key)
           
 String get(String key, String defaultValue)
          Gets the String value associated with the given key.
 boolean getBoolean(String key)
           
 boolean getBoolean(String key, boolean defaultValue)
          Gets the boolean value associated with the given key.
 float getFloat(String key)
           
 float getFloat(String key, float defaultValue)
          Gets the float value associated with the given key.
 int getInt(String key)
           
 int getInt(String key, int defaultValue)
          Gets the integer value associated with the given key.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

Properties

public Properties()

Properties

public Properties(Map<String,String> property)
Method Detail

add

public void add(String key,
                String value)

add

public void add(String key,
                int value)

add

public void add(String key,
                long value)

add

public void add(String key,
                float value)

add

public void add(String key,
                boolean value)

get

public String get(String key)

get

public String get(String key,
                  String defaultValue)
Gets the String value associated with the given key. If any corresponding value is not found, returns the default value.

Parameters:
key - the key
defaultValue - the default value
Returns:
the string value

getInt

public int getInt(String key)

getInt

public int getInt(String key,
                  int defaultValue)
Gets the integer value associated with the given key. If any corresponding value is not found, returns the given default value

Parameters:
key -
defaultValue -
Returns:

getFloat

public float getFloat(String key)

getFloat

public float getFloat(String key,
                      float defaultValue)
Gets the float value associated with the given key. If any corresponding value is not found, returns the given default value

Parameters:
key -
defaultValue -
Returns:

getBoolean

public boolean getBoolean(String key)

getBoolean

public boolean getBoolean(String key,
                          boolean defaultValue)
Gets the boolean value associated with the given key. If any corresponding value is not found, returns the given default value

Parameters:
key -
defaultValue -
Returns:


Copyright © 2007-2012 utgenome.org. All Rights Reserved.