Class NCMap

  • All Implemented Interfaces:
    INCExternalizable

    public final class NCMap
    extends NCType
    A Dictionary mapping NCType keys to NCType objects. Note that this class is **NOT** Thread-safe in its current form.
    • Constructor Summary

      Constructors 
      Constructor Description
      NCMap()
      Default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      NCMap clear()
      Removes all entries from this NCMap object.
      boolean containsKey​(NCType key)
      Returns true if this NCMap contains a mapping for the specified key.
      boolean containsKey​(java.lang.String key)
      Returns true if this NCMap contains a mapping for the specified key.
      java.util.Iterator<java.util.Map.Entry<NCType,​NCType>> entries()
      Returns an iterator over the mappings in this IDicitonary.
      java.util.Set<java.util.Map.Entry<NCType,​NCType>> entrySet()
      Returns a set of Map.Entry objects.
      boolean equals​(java.lang.Object other)
      Force subclasses to implement.
      NCType get​(NCType key)
      Returns the NCType object associated with the specified key.
      NCType get​(java.lang.String key)
      Returns the NCType object associated with the specified key.
      boolean getBool​(java.lang.String key)
      Returns the boolean value associated with the specified key.
      byte[] getByteArray​(java.lang.String key)
      Returns the byte[] value associated with the specified key.
      java.nio.ByteBuffer getBytes​(java.lang.String key)
      Returns the ByteBuffer value associated with the specified key.
      java.util.Date getDate​(java.lang.String key)
      Returns the date value associated with the specified key.
      double getDouble​(java.lang.String key)
      Returns the double value associated with the specified key.
      int getInt​(java.lang.String key)
      Returns the int value associated with the specified key.
      NCList getList​(java.lang.String key)
      Returns the NCList value associated with the specified key.
      long getLong​(java.lang.String key)
      Returns the long value associated with the specified key.
      NCMap getMap​(java.lang.String key)
      Returns the NCMap value associated with the specified key.
      java.lang.String getString​(java.lang.String key)
      Returns the String value associated with the specified key.
      int getType()
      Returns the type of this NCType object.
      int hashCode()
      Force subclasses to implement.
      boolean isEmtpy()
      Returns true if the NCMap is empty
      NCMap put​(NCType key, NCType value)
      Add a key/value pair to this map.
      NCMap put​(java.lang.String key, boolean value)
      Add a key/value pair to this map.
      NCMap put​(java.lang.String key, byte[] value)
      Add a key/value pair to this map.
      NCMap put​(java.lang.String key, double value)
      Add a key/value pair to this map.
      NCMap put​(java.lang.String key, int value)
      Add a key/value pair to this map.
      NCMap put​(java.lang.String key, long value)
      Add a key/value pair to this map.
      NCMap put​(java.lang.String key, INCExternalizable value)
      Add a key/value pair to this map.
      NCMap put​(java.lang.String key, NCType value)
      Add a key/value pair to this map.
      NCMap put​(java.lang.String key, java.lang.String value)
      Add a key/value pair to this map.
      NCMap put​(java.lang.String key, java.nio.ByteBuffer value)
      Add a key/value pair to this map.
      NCMap put​(java.lang.String key, java.util.Date value)
      Add a key/value pair to this map.
      NCType remove​(NCType key)
      Removes the mapping for this key from this NCMap if it is present.
      NCType remove​(java.lang.String key)
      Removes the mapping for this key from this NCMap if it is present.
      int size()
      Returns the number of entries in the NCMap.
      java.lang.String toString()
      Force subclasses to implement.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • NCMap

        public NCMap()
        Default constructor
    • Method Detail

      • size

        public int size()
        Returns the number of entries in the NCMap.
        Returns:
        number of entries in the NCMap.
      • isEmtpy

        public boolean isEmtpy()
        Returns true if the NCMap is empty
        Returns:
        true if the NCMap is empty
      • entries

        public java.util.Iterator<java.util.Map.Entry<NCType,​NCType>> entries()
        Returns an iterator over the mappings in this IDicitonary. The elements are returned in no particular order.
        Returns:
        a Iterator containing java.util.Map.Entry Objects
      • entrySet

        public java.util.Set<java.util.Map.Entry<NCType,​NCType>> entrySet()
        Returns a set of Map.Entry objects.
        Returns:
        set of Map.Entry objects.
      • containsKey

        public boolean containsKey​(NCType key)
        Returns true if this NCMap contains a mapping for the specified key.
        Parameters:
        key - - key to check
        Returns:
        true if this NCMap contains a mapping for the specified key.
      • containsKey

        public boolean containsKey​(java.lang.String key)
        Returns true if this NCMap contains a mapping for the specified key.
        Parameters:
        key - - key to check
        Returns:
        true if this NCMap contains a mapping for the specified key.
      • put

        public NCMap put​(NCType key,
                         NCType value)
        Add a key/value pair to this map.
        Parameters:
        key - the key
        value - the value
        Returns:
        the NCMap
      • put

        public NCMap put​(java.lang.String key,
                         NCType value)
        Add a key/value pair to this map.
        Parameters:
        key - the key
        value - the value
        Returns:
        the NCMap
      • put

        public NCMap put​(java.lang.String key,
                         INCExternalizable value)
        Add a key/value pair to this map.
        Parameters:
        key - the key
        value - the value
        Returns:
        the NCMap
      • put

        public NCMap put​(java.lang.String key,
                         java.lang.String value)
        Add a key/value pair to this map.
        Parameters:
        key - the key
        value - the value
        Returns:
        the NCMap
      • put

        public NCMap put​(java.lang.String key,
                         boolean value)
        Add a key/value pair to this map.
        Parameters:
        key - the key
        value - the value
        Returns:
        the NCMap
      • put

        public NCMap put​(java.lang.String key,
                         int value)
        Add a key/value pair to this map.
        Parameters:
        key - the key
        value - the value
        Returns:
        the NCMap
      • put

        public NCMap put​(java.lang.String key,
                         long value)
        Add a key/value pair to this map.
        Parameters:
        key - the key
        value - the value
        Returns:
        the NCMap
      • put

        public NCMap put​(java.lang.String key,
                         double value)
        Add a key/value pair to this map.
        Parameters:
        key - the key
        value - the value
        Returns:
        the NCMap
      • put

        public NCMap put​(java.lang.String key,
                         java.util.Date value)
        Add a key/value pair to this map.
        Parameters:
        key - the key
        value - the value
        Returns:
        the NCMap
      • put

        public NCMap put​(java.lang.String key,
                         byte[] value)
        Add a key/value pair to this map.
        Parameters:
        key - the key
        value - the value
        Returns:
        the NCMap
      • put

        public NCMap put​(java.lang.String key,
                         java.nio.ByteBuffer value)
        Add a key/value pair to this map.
        Parameters:
        key - the key
        value - the value
        Returns:
        the NCMap
      • get

        public NCType get​(NCType key)
        Returns the NCType object associated with the specified key. Returns null if the NCMap contains no entry for this key.
        Parameters:
        key - key to retrieve
        Returns:
        value associated with the specified key; null if the key has no value associated
      • get

        public NCType get​(java.lang.String key)
        Returns the NCType object associated with the specified key. Returns null if the NCMap contains no entry for this key.
        Parameters:
        key - key to retrieve
        Returns:
        value associated with the specified key; null if the key has no value associated
      • getString

        public java.lang.String getString​(java.lang.String key)
                                   throws BadMessageException
        Returns the String value associated with the specified key.
        Parameters:
        key - the key String
        Returns:
        String value
        Throws:
        BadMessageException - if the requested value is not present or of a bad type
      • getBool

        public boolean getBool​(java.lang.String key)
                        throws BadMessageException
        Returns the boolean value associated with the specified key.
        Parameters:
        key - the key String
        Returns:
        boolean value
        Throws:
        BadMessageException - if the requested value is not present or of a bad type
      • getDouble

        public double getDouble​(java.lang.String key)
                         throws BadMessageException
        Returns the double value associated with the specified key.
        Parameters:
        key - the key String
        Returns:
        double value
        Throws:
        BadMessageException - if the requested value is not present or of a bad type
      • getInt

        public int getInt​(java.lang.String key)
                   throws BadMessageException
        Returns the int value associated with the specified key.
        Parameters:
        key - the key String
        Returns:
        int value
        Throws:
        BadMessageException - if the requested value is not present or of a bad type
      • getLong

        public long getLong​(java.lang.String key)
                     throws BadMessageException
        Returns the long value associated with the specified key.
        Parameters:
        key - the key String
        Returns:
        long value
        Throws:
        BadMessageException - if the requested value is not present or of a bad type
      • getDate

        public java.util.Date getDate​(java.lang.String key)
                               throws BadMessageException
        Returns the date value associated with the specified key.
        Parameters:
        key - the key String
        Returns:
        date value
        Throws:
        BadMessageException - if the requested value is not present or of a bad type
      • getByteArray

        public byte[] getByteArray​(java.lang.String key)
                            throws BadMessageException
        Returns the byte[] value associated with the specified key.
        Parameters:
        key - the key String
        Returns:
        byte[] value
        Throws:
        BadMessageException - if the requested value is not present or of a bad type
      • getBytes

        public java.nio.ByteBuffer getBytes​(java.lang.String key)
                                     throws BadMessageException
        Returns the ByteBuffer value associated with the specified key.
        Parameters:
        key - the key String
        Returns:
        ByteBuffer value
        Throws:
        BadMessageException - if the requested value is not present or of a bad type
      • getList

        public NCList getList​(java.lang.String key)
                       throws BadMessageException
        Returns the NCList value associated with the specified key.
        Parameters:
        key - the key String
        Returns:
        NCList value
        Throws:
        BadMessageException - if the requested value is not present or of a bad type
      • getMap

        public NCMap getMap​(java.lang.String key)
                     throws BadMessageException
        Returns the NCMap value associated with the specified key.
        Parameters:
        key - the key String
        Returns:
        NCMap value
        Throws:
        BadMessageException - if the associated value is not present or not of the correct type
      • remove

        public NCType remove​(NCType key)
        Removes the mapping for this key from this NCMap if it is present.
        Parameters:
        key - key whose associated NCType object is to be removed
        Returns:
        previous NCType object associated with the specified key, or null if there was no mapping for the key
      • remove

        public NCType remove​(java.lang.String key)
        Removes the mapping for this key from this NCMap if it is present.
        Parameters:
        key - key whose associated NCType object is to be removed
        Returns:
        previous NCType object associated with the specified key, or null if there was no mapping for the key
      • clear

        public NCMap clear()
        Removes all entries from this NCMap object.
        Returns:
        the NCMap
      • getType

        public int getType()
        Description copied from class: NCType
        Returns the type of this NCType object.
        Specified by:
        getType in class NCType
        Returns:
        the type of this NCType
      • equals

        public boolean equals​(java.lang.Object other)
        Description copied from class: NCType
        Force subclasses to implement.
        Specified by:
        equals in class NCType
        See Also:
        Object.equals(java.lang.Object)
      • toString

        public java.lang.String toString()
        Description copied from class: NCType
        Force subclasses to implement.
        Specified by:
        toString in class NCType
        See Also:
        Object.toString()
      • hashCode

        public int hashCode()
        Description copied from class: NCType
        Force subclasses to implement.
        Specified by:
        hashCode in class NCType
        See Also:
        Object.hashCode()