Class MapProperties


  • public class MapProperties
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      MapProperties()
      Creates an empty properties set
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Removes all properties
      boolean containsKey​(java.lang.String key)  
      java.lang.Object get​(java.lang.String key)  
      <T> T get​(java.lang.String key, java.lang.Class<T> clazz)
      Returns the object for the given key, casting it to clazz.
      <T> T get​(java.lang.String key, T defaultValue, java.lang.Class<T> clazz)
      Returns the object for the given key, casting it to clazz.
      java.util.Iterator<java.lang.String> getKeys()  
      java.util.Iterator<java.lang.Object> getValues()  
      void put​(java.lang.String key, java.lang.Object value)  
      void putAll​(MapProperties properties)  
      void remove​(java.lang.String key)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MapProperties

        public MapProperties()
        Creates an empty properties set
    • Method Detail

      • containsKey

        public boolean containsKey​(java.lang.String key)
        Parameters:
        key - property name
        Returns:
        true if and only if the property exists
      • get

        public java.lang.Object get​(java.lang.String key)
        Parameters:
        key - property name
        Returns:
        the value for that property if it exists, otherwise, null
      • get

        public <T> T get​(java.lang.String key,
                         java.lang.Class<T> clazz)
        Returns the object for the given key, casting it to clazz.
        Parameters:
        key - the key of the object
        clazz - the class of the object
        Returns:
        the object or null if the object is not in the map
        Throws:
        java.lang.ClassCastException - if the object with the given key is not of type clazz
      • get

        public <T> T get​(java.lang.String key,
                         T defaultValue,
                         java.lang.Class<T> clazz)
        Returns the object for the given key, casting it to clazz.
        Parameters:
        key - the key of the object
        defaultValue - the default value
        clazz - the class of the object
        Returns:
        the object or the defaultValue if the object is not in the map
        Throws:
        java.lang.ClassCastException - if the object with the given key is not of type clazz
      • put

        public void put​(java.lang.String key,
                        java.lang.Object value)
        Parameters:
        key - property name
        value - value to be inserted or modified (if it already existed)
      • putAll

        public void putAll​(MapProperties properties)
        Parameters:
        properties - set of properties to be added
      • remove

        public void remove​(java.lang.String key)
        Parameters:
        key - property name to be removed
      • clear

        public void clear()
        Removes all properties
      • getKeys

        public java.util.Iterator<java.lang.String> getKeys()
        Returns:
        iterator for the property names
      • getValues

        public java.util.Iterator<java.lang.Object> getValues()
        Returns:
        iterator to properties' values