Class WMSProperties

  • All Implemented Interfaces:
    java.io.Serializable, Cloneable, java.util.Map

    public class WMSProperties
    extends java.util.HashMap

    WMSProperties: generic properties container used by many class to store extended property information. Acts like a simple Map with some simple utilities for performing type conversion.

    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends Object,​V extends Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends Object,​V extends Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends Object,​V extends Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      WMSProperties()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void cloneProperties​(WMSProperties from, WMSProperties to)
      Copy all properties from "from" properties object to "to" properties object.
      String[] getAllAsStrings()
      Return all properties as String[].
      java.util.Map<String,​String> getMatchingEntries​(String prefix, java.util.ArrayList<String> types)  
      Object getProperty​(String name)
      Get property value as generic object.
      boolean getPropertyBoolean​(boolean defaultValue, String... locations)
      Get property as boolean, return default value if does not exist.
      boolean getPropertyBoolean​(String name, boolean defaultVal)
      Get property as boolean, return default value if does not exist.
      double getPropertyDouble​(double defaultValue, String... locations)
      Get property as double, return default value if does not exist.
      double getPropertyDouble​(String name, double defaultVal)
      Get property as double, return default value if does not exist.
      int getPropertyInt​(int defaultValue, String... locations)
      Get property as int, return default value if does not exist.
      int getPropertyInt​(String name, int defaultVal)
      Get property as int, return default value if does not exist.
      long getPropertyLong​(String name, long defaultVal)
      Get property as long, return default value if does not exist.
      String getPropertyStr​(String name)
      Get property as String
      String getPropertyStr​(String name, String defaultVal)
      Get property as String, return default value if does not exist.
      String getPropertyString​(String defaultValue, String... locations)
      Get property as String, return default value if does not exist.
      void loadFromProperties​(java.util.Properties props)  
      void putAll​(java.util.Map m)  
      void setProperty​(String name, Object value)
      Set property to generic object.
      String toJSON()  
      String toString()  
      • Methods inherited from class java.util.HashMap

        clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        equals, hashCode
    • Constructor Detail

      • WMSProperties

        public WMSProperties()
    • Method Detail

      • cloneProperties

        public static void cloneProperties​(WMSProperties from,
                                           WMSProperties to)
        Copy all properties from "from" properties object to "to" properties object.
        Parameters:
        from - source properties
        to - destination properties
      • loadFromProperties

        public void loadFromProperties​(java.util.Properties props)
      • setProperty

        public void setProperty​(String name,
                                Object value)
        Set property to generic object.
        Parameters:
        name - property name
        value - value
      • getProperty

        public Object getProperty​(String name)
        Get property value as generic object.
        Parameters:
        name - property name
        Returns:
        value, null if does not exist
      • getPropertyStr

        public String getPropertyStr​(String name)
        Get property as String
        Parameters:
        name - property name
        Returns:
        value as String, null if does not exist
      • getPropertyDouble

        public double getPropertyDouble​(double defaultValue,
                                        String... locations)
        Get property as double, return default value if does not exist.
        Parameters:
        defaultValue - property default value
        locations - , an ordered list of property keys to search for
        Returns:
        the first property found, defaultVal if does not exist
      • getPropertyBoolean

        public boolean getPropertyBoolean​(boolean defaultValue,
                                          String... locations)
        Get property as boolean, return default value if does not exist.
        Parameters:
        defaultValue - property default value
        locations - , an ordered list of property keys to search for
        Returns:
        the first property found, defaultVal if does not exist
      • getPropertyInt

        public int getPropertyInt​(int defaultValue,
                                  String... locations)
        Get property as int, return default value if does not exist.
        Parameters:
        defaultValue - property default value
        locations - , an ordered list of property keys to search for
        Returns:
        the first property found, defaultVal if does not exist
      • getPropertyString

        public String getPropertyString​(String defaultValue,
                                        String... locations)
        Get property as String, return default value if does not exist.
        Parameters:
        defaultValue - property default value
        locations - , an ordered list of property keys to search for
        Returns:
        the first property found, defaultVal if does not exist
      • getPropertyStr

        public String getPropertyStr​(String name,
                                     String defaultVal)
        Get property as String, return default value if does not exist.
        Parameters:
        name - property name
        defaultVal - default value
        Returns:
        value as String, defaultVal if does not exist
      • getPropertyBoolean

        public boolean getPropertyBoolean​(String name,
                                          boolean defaultVal)
        Get property as boolean, return default value if does not exist.
        Parameters:
        name - property name
        defaultVal - default value
        Returns:
        value as boolean, defaultVal if does not exist
      • getPropertyInt

        public int getPropertyInt​(String name,
                                  int defaultVal)
        Get property as int, return default value if does not exist.
        Parameters:
        name - property name
        defaultVal - default value
        Returns:
        value as boolean, defaultVal if does not exist
      • getPropertyLong

        public long getPropertyLong​(String name,
                                    long defaultVal)
        Get property as long, return default value if does not exist.
        Parameters:
        name - property name
        defaultVal - default value
        Returns:
        value as long, defaultVal if does not exist
      • getPropertyDouble

        public double getPropertyDouble​(String name,
                                        double defaultVal)
        Get property as double, return default value if does not exist.
        Parameters:
        name - property name
        defaultVal - default value
        Returns:
        value as double, defaultVal if does not exist
      • getMatchingEntries

        public java.util.Map<String,​String> getMatchingEntries​(String prefix,
                                                                     java.util.ArrayList<String> types)
      • getAllAsStrings

        public String[] getAllAsStrings()
        Return all properties as String[]. Format is "key=value".
        Returns:
        all properties as String[]
      • toJSON

        public String toJSON()
      • toString

        public String toString()
        Overrides:
        toString in class java.util.AbstractMap
      • putAll

        public void putAll​(java.util.Map m)
        Specified by:
        putAll in interface java.util.Map
        Overrides:
        putAll in class java.util.HashMap