com.ibm.commerce.giftcenter.facade.client.util

Class TypedMap

  • java.lang.Object
    • com.ibm.commerce.giftcenter.facade.client.util.TypedMap


  • public class TypedMap
    extends java.lang.Object
    This class is a wrapper to a java.util.Map object. It provides additional methods for retrieving properties such as java.lang.Integer, java.lang.Double, java.lang.Float & java.lang.String instead of java.lang.Object.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      The IBM Copyright notice field.
    • Constructor Summary

      Constructors 
      Constructor and Description
      TypedMap(java.util.Map argMap)
      This constructor creates a typed property object from the given hashtable.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.Object get(java.lang.String key)
      This method returns the Object associated with the specified key.
      java.lang.Object get(java.lang.String key, java.lang.Object def)
      This method returns the Object associated with the specified key.
      java.lang.String[] getArray(java.lang.String key)
      This method returns the object associated with the given key as an array of String objects.
      java.lang.String[] getArray(java.lang.String key, java.lang.String[] def)
      This method returns the object associated with the given key as an array of String objects.
      java.math.BigDecimal getBigDecimal(java.lang.String key)
      This method returns the object associated with the given key as a BigDecimal object.
      java.math.BigDecimal getBigDecimal(java.lang.String key, java.math.BigDecimal def)
      This method returns the object associated with the given key as a BigDecimal object.
      boolean getBoolean(java.lang.String key)
      This method returns the object associated with the given key as a boolean value.
      boolean getBoolean(java.lang.String key, boolean def)
      This method returns the object associated with the given key as a boolean value.
      java.lang.Double getDouble(java.lang.String key)
      This method returns the object associated with the given key as a Double object.
      java.lang.Double getDouble(java.lang.String key, double def)
      This method returns the object associated with the given key as a Double object.
      java.lang.Double getDouble(java.lang.String key, java.lang.Double def)
      This method returns the object associated with the given key as a Double object.
      double getDoubleValue(java.lang.String key)
      This method returns the object associated with the given key as a double value.
      double getDoubleValue(java.lang.String key, double def)
      This method returns the object associated with the given key as a double value.
      java.lang.Float getFloat(java.lang.String key)
      This method returns the object associated with the given key as a Float object.
      java.lang.Float getFloat(java.lang.String key, float def)
      This method returns the object associated with the given key as a Float object.
      java.lang.Float getFloat(java.lang.String key, java.lang.Float def)
      This method returns the object associated with the given key as a Float object.
      float getFloatValue(java.lang.String key)
      This method returns the object associated with the given key as a float value.
      float getFloatValue(java.lang.String key, float def)
      This method returns the value associated with the given key as a float value.
      java.lang.Integer getInteger(java.lang.String key)
      This method returns the object associated with the given key as an Integer object.
      java.lang.Integer getInteger(java.lang.String key, int def)
      This method returns the object associated with the given key as an Integer object.
      java.lang.Integer getInteger(java.lang.String key, java.lang.Integer def)
      This method returns the object associated with the given key as an Integer object.
      int getIntValue(java.lang.String key)
      This method returns the object associated with the given key as an integer value.
      int getIntValue(java.lang.String key, int def)
      This method returns the object associated with the given key as an integer value.
      java.lang.Long getLong(java.lang.String key)
      This method returns the object associated with the given key as a Long object.
      java.lang.Long getLong(java.lang.String key, long def)
      This method returns the object associated with the given key as a Long object.
      java.lang.Long getLong(java.lang.String key, java.lang.Long def)
      This method returns the object associated with the given key as a Long object.
      java.lang.Long[] getLongArray(java.lang.String key)
      This method returns the object associated with the given key as an array of Long objects.
      java.lang.Long[] getLongArray(java.lang.String key, java.lang.Long[] def)
      This method returns the object associated with the given key as an array of Long objects.
      long getLongValue(java.lang.String key)
      This method returns the object associated with the given key as a long value.
      long getLongValue(java.lang.String key, long def)
      This method returns the object associated with the given key as a long value.
      java.util.Map getMap() 
      java.lang.Short getShort(java.lang.String key)
      This method returns the object associated with the given key as a Short object.
      java.lang.Short getShort(java.lang.String key, short def)
      This method returns the object associated with the given key as a Short object.
      java.lang.Short getShort(java.lang.String key, java.lang.Short def)
      This method returns the object associated with the given key as a Short object.
      short getShortValue(java.lang.String key)
      This method returns the object associated with the given key as a short value.
      short getShortValue(java.lang.String key, short def)
      This method returns the object associated with the given key as a short value..
      java.lang.String getString(java.lang.String key)
      This method returns the value associated with the key as a String object.
      java.lang.String getString(java.lang.String key, java.lang.String def)
      This method returns the object associated with the key as a String object.
      static java.lang.String[] objectToArrayOfString(java.lang.Object aObject, java.lang.String[] def)
      This method converts a TypedProperty object to an array of String objects.
      static java.lang.String objectToString(java.lang.Object aObject, java.lang.String def)
      This method converts a TypedProperty object to a String object.
      void setMap(java.util.Map argMap) 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        The IBM Copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • TypedMap

        public TypedMap(java.util.Map argMap)
        This constructor creates a typed property object from the given hashtable.
        Parameters:
        argMap - The hashtable to base the typed property object on.
    • Method Detail

      • get

        public java.lang.Object get(java.lang.String key)
                             throws GiftCenterException
        This method returns the Object associated with the specified key.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        The Object associated with the specified key.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the parameter does not exist in the TypedProperty object.
        GiftCenterException
      • get

        public java.lang.Object get(java.lang.String key,
                                    java.lang.Object def)
        This method returns the Object associated with the specified key. If the object does not exist, the default object is returned.
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        The Object corresponding to the key specified, or the default object if the key cannot be found.
      • objectToArrayOfString

        public static java.lang.String[] objectToArrayOfString(java.lang.Object aObject,
                                                               java.lang.String[] def)
        This method converts a TypedProperty object to an array of String objects. If the object is null, a specified default object is returned. If the object is not an array, an array with a single element (the original object) is returned. If the object is an array, an array with the same number of elements is returned. Each element is either null, or the element converted to a String.
        Parameters:
        aObject - The object to be converted.
        def - The default object.
        Returns:
        An array of String objects.
      • getArray

        public java.lang.String[] getArray(java.lang.String key)
                                    throws GiftCenterException
        This method returns the object associated with the given key as an array of String objects. If the object is null, a GiftCenterException is thrown. If the object is an array of String objects, it is returned. If the object is an array, a new String array is created, and each non-null element of the object is converted to a String object by calling its toString() method. Otherwise, a new array of String objects is created with one element, whose value is the result of calling the object's toString() method.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        An array of String objects.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the parameter is not found in the TypedProperty object.
        GiftCenterException
      • getArray

        public java.lang.String[] getArray(java.lang.String key,
                                           java.lang.String[] def)
        This method returns the object associated with the given key as an array of String objects. If the object is null, the specified default object is returned. If the object is an array of String objects, it is returned. If the object is an array of type Object, a new String array is created, and each non-null element of the object is converted to a String object by calling its toString() method. Otherwise, a new array of String objects is created with one element, whose value is the result of calling the object's toString() method.
        Parameters:
        key - The key of the parameter to find.
        def - the default value.
        Returns:
        An array of String objects.
      • getBigDecimal

        public java.math.BigDecimal getBigDecimal(java.lang.String key)
                                           throws GiftCenterException
        This method returns the object associated with the given key as a BigDecimal object.
        Parameters:
        key - The key associated with the parameter to find.
        Returns:
        The specified parameter as a BigDecimal object.
        Throws:
        GiftCenterException - Thrown if the object cannot be converted to a BigDecimal object or thrown if the specified parameter does not exist.
      • getBigDecimal

        public java.math.BigDecimal getBigDecimal(java.lang.String key,
                                                  java.math.BigDecimal def)
                                           throws GiftCenterException
        This method returns the object associated with the given key as a BigDecimal object.
        Parameters:
        key - The key of the parameter to find.
        def - The default value associated with the parameter.
        Returns:
        The specified parameter as a BigDecimal object. If the value cannot be found or converted into a BigDecimal object, the default value specified is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted to a BigDecimal object.
        GiftCenterException
      • getBoolean

        public boolean getBoolean(java.lang.String key)
                           throws GiftCenterException
        This method returns the object associated with the given key as a boolean value.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        The boolean value associated with the specified parameter.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the parameter specified cannot be found.
        GiftCenterException
      • getBoolean

        public boolean getBoolean(java.lang.String key,
                                  boolean def)
        This method returns the object associated with the given key as a boolean value.
        Parameters:
        key - The key of the parameter to find.
        def - The default value associated with the parameter.
        Returns:
        The boolean value associated with the specified parameter. If the parameter cannot be found, the default value specified is returned.
      • getDouble

        public java.lang.Double getDouble(java.lang.String key)
                                   throws GiftCenterException
        This method returns the object associated with the given key as a Double object.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        The specified parameter as a Double object.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the value cannot be converted to a Double object.
        GiftCenterException
      • getDouble

        public java.lang.Double getDouble(java.lang.String key,
                                          double def)
                                   throws GiftCenterException
        This method returns the object associated with the given key as a Double object.
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        The specified parameter as a Double object. If the parameter cannot be found or converted to a Double object, the default object is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the value cannot be converted to a Double object.
        GiftCenterException
      • getDouble

        public java.lang.Double getDouble(java.lang.String key,
                                          java.lang.Double def)
                                   throws GiftCenterException
        This method returns the object associated with the given key as a Double object.
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        The object associated with the parameter as a Double object. If the parameter cannot be found or converted to a Double object, the default object is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the value cannot be converted to a Double object.
        GiftCenterException
      • getDoubleValue

        public double getDoubleValue(java.lang.String key)
                              throws GiftCenterException
        This method returns the object associated with the given key as a double value.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        The object associated with the parameter as a double value.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the parameter cannot be found.
        GiftCenterException
      • getDoubleValue

        public double getDoubleValue(java.lang.String key,
                                     double def)
                              throws GiftCenterException
        This method returns the object associated with the given key as a double value.
        Parameters:
        key - The key of the parameter to find.
        def - The default value associated with the parameter.
        Returns:
        The object associated with the parameter as a double value. If the object cannot be found or converted, the default value specified is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the parameter cannot be found or if the object cannot be converted to a Double object.
        GiftCenterException
      • getFloat

        public java.lang.Float getFloat(java.lang.String key)
                                 throws GiftCenterException
        This method returns the object associated with the given key as a Float object.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        The object associated with the parameter as a Float object.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted to a Float object. or thrown if the parameter cannot be found.
        GiftCenterException
      • getFloat

        public java.lang.Float getFloat(java.lang.String key,
                                        float def)
                                 throws GiftCenterException
        This method returns the object associated with the given key as a Float object.
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        The object associated with the parameter as a Float object. If the object cannot be found or converted to a Float, the default object specified is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted to a Float object.
        GiftCenterException
      • getFloat

        public java.lang.Float getFloat(java.lang.String key,
                                        java.lang.Float def)
                                 throws GiftCenterException
        This method returns the object associated with the given key as a Float object.
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        The object associated with the parameter as a Float object. If the value cannot be found or converted to a Float object, the default object specified is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted to a Float object.
        GiftCenterException
      • getFloatValue

        public float getFloatValue(java.lang.String key)
                            throws GiftCenterException
        This method returns the object associated with the given key as a float value.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        The object associated with the parameter as a float value.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the value cannot be converted in to float or thrown if the parameter cannot be found.
        GiftCenterException
      • getFloatValue

        public float getFloatValue(java.lang.String key,
                                   float def)
                            throws GiftCenterException
        This method returns the value associated with the given key as a float value.
        Parameters:
        key - The key of the parameter to find.
        def - The default value associated with the parameter.
        Returns:
        The object associated with the parameter as a float value. If the object cannot be found or converted to a float, the default value specified is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted to a Float object.
        GiftCenterException
      • getInteger

        public java.lang.Integer getInteger(java.lang.String key)
                                     throws GiftCenterException
        This method returns the object associated with the given key as an Integer object.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        The object associated with the parameter as an Integer object.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the value cannot be converted to an Integer object or thrown if the parameter cannot be found.
        GiftCenterException
      • getInteger

        public java.lang.Integer getInteger(java.lang.String key,
                                            int def)
                                     throws GiftCenterException
        This method returns the object associated with the given key as an Integer object.
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        The object associated with the parameter as an Integer object. If the object cannot be found or converted to an Integer object, the default object specified is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the value cannot be converted to an Integer object.
        GiftCenterException
      • getInteger

        public java.lang.Integer getInteger(java.lang.String key,
                                            java.lang.Integer def)
                                     throws GiftCenterException
        This method returns the object associated with the given key as an Integer object.
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        The object associated with the parameter as an Integer object. If the object cannot be found or converted to an Integer object, the default object specified is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the value cannot be converted to an Integer object.
        GiftCenterException
      • getIntValue

        public int getIntValue(java.lang.String key)
                        throws GiftCenterException
        This method returns the object associated with the given key as an integer value.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        The object associated with the parameter as an integer value.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted to an integer value or thrown if the parameter cannot be found.
        GiftCenterException
      • getIntValue

        public int getIntValue(java.lang.String key,
                               int def)
                        throws GiftCenterException
        This method returns the object associated with the given key as an integer value.
        Parameters:
        key - The key of the parameter to find.
        def - The default value associated with the parameter.
        Returns:
        The object associated with the parameter as an integer value. If the object cannot be found or converted to an integer, the default value is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted to an integer value.
        GiftCenterException
      • getLong

        public java.lang.Long getLong(java.lang.String key)
                               throws GiftCenterException
        This method returns the object associated with the given key as a Long object.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        The object associated with the parameter as a Long object.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the value cannot be converted in to a Long object or thrown if the parameter cannot be found.
        GiftCenterException
      • getLong

        public java.lang.Long getLong(java.lang.String key,
                                      long def)
                               throws GiftCenterException
        This method returns the object associated with the given key as a Long object.
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        The object associated with the parameter as a Long object. If the object cannot be found or converted to a Long object, the default object is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the value cannot be converted in to a Long object.
        GiftCenterException
      • getLong

        public java.lang.Long getLong(java.lang.String key,
                                      java.lang.Long def)
                               throws GiftCenterException
        This method returns the object associated with the given key as a Long object.
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        The object associated with the parameter as a Long object. If the value cannot be found or converted to a Long, the default object is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the value cannot be converted in to a Long object.
        GiftCenterException
      • getLongArray

        public java.lang.Long[] getLongArray(java.lang.String key)
                                      throws GiftCenterException,
                                             GiftCenterException
        This method returns the object associated with the given key as an array of Long objects.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        The object associated with the parameter as an array of Long objects.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted in to an array of Long objects.
        com.ibm.commerce.exception.GiftCenterException - Thrown if the parameter cannot be found.
        GiftCenterException
      • getLongArray

        public java.lang.Long[] getLongArray(java.lang.String key,
                                             java.lang.Long[] def)
        This method returns the object associated with the given key as an array of Long objects.
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        The object associated with the parameter as an array of Long objects. If the object cannot be found or converted to an array of Long objects, the default object is returned.
      • getLongValue

        public long getLongValue(java.lang.String key)
                          throws GiftCenterException
        This method returns the object associated with the given key as a long value.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        The object associated with the parameter as a long value.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted to a long value or thrown if the parameter cannot be found.
        GiftCenterException
      • getLongValue

        public long getLongValue(java.lang.String key,
                                 long def)
                          throws GiftCenterException
        This method returns the object associated with the given key as a long value.
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        The object associated with the parameter as a long value. If the object cannot be found or converted to a long value, the default value is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted to a long value.
        GiftCenterException
      • getShort

        public java.lang.Short getShort(java.lang.String key)
                                 throws GiftCenterException
        This method returns the object associated with the given key as a Short object.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        The object associated with the parameter as a Short object.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted in to a Short object or thrown if the parameter cannot be found.
        GiftCenterException
      • getShort

        public java.lang.Short getShort(java.lang.String key,
                                        java.lang.Short def)
                                 throws GiftCenterException
        This method returns the object associated with the given key as a Short object.
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        The object associated with the parameter as a Short object. If the object cannot be found or converted to a Short object, the default object is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted in to a Short object.
        GiftCenterException
      • getShort

        public java.lang.Short getShort(java.lang.String key,
                                        short def)
                                 throws GiftCenterException
        This method returns the object associated with the given key as a Short object.
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        The object associated with the parameter as a Short object. If the object cannot be found or converted to a Short object, the default object is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted in to a Short object.
        GiftCenterException
      • getShortValue

        public short getShortValue(java.lang.String key)
                            throws GiftCenterException
        This method returns the object associated with the given key as a short value.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        The object associated with the parameter as a short value.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted to a short value or thrown if the parameter cannot be found.
        GiftCenterException
      • getShortValue

        public short getShortValue(java.lang.String key,
                                   short def)
                            throws GiftCenterException
        This method returns the object associated with the given key as a short value..
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        The object associated with the parameter as a short value. If the object cannot be found or converted to a short value, the default value is returned.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the object cannot be converted to a short value.
        GiftCenterException
      • objectToString

        public static java.lang.String objectToString(java.lang.Object aObject,
                                                      java.lang.String def)
        This method converts a TypedProperty object to a String object. If the object is an array, the first element is converted. If the object is null, the specified default object is returned.
        Parameters:
        aObject - The value to convert.
        def - The default object.
        Returns:
        A String of the TypedProperty object.
      • getString

        public java.lang.String getString(java.lang.String key)
                                   throws GiftCenterException
        This method returns the value associated with the key as a String object. If the object is an array and there is a non-null first element, that element is converted to a String by calling its toString() method. Otherwise, if the object is an array, but there is no non-null first element, a GiftCenterException is thrown. Otherwise, if the value is not null, it is converted to a String by calling its toString() method. Otherwise, a GiftCenterException is thrown.
        Parameters:
        key - The key of the parameter to find.
        Returns:
        A String representation of the parameter.
        Throws:
        com.ibm.commerce.exception.GiftCenterException - Thrown if the parameter cannot be found.
        GiftCenterException
      • getString

        public java.lang.String getString(java.lang.String key,
                                          java.lang.String def)
        This method returns the object associated with the key as a String object. If the object is an array and there is a non-null first element, that element is converted to a String by calling its toString() method. Otherwise, if the object is an array, but there is no non-null first element, the specified default object is returned. Otherwise, if the value is not null, it is converted to a String by calling its toString() method. Otherwise, the specified default value is returned.
        Parameters:
        key - The key of the parameter to find.
        def - The default object associated with the parameter.
        Returns:
        A String representation of the parameter. If the object cannot be found or converted to a String object, the default object is returned.
      • getMap

        public java.util.Map getMap()
        Returns:
        Returns the map.
      • setMap

        public void setMap(java.util.Map argMap)
        Parameters:
        argMap - The map to set.