Class ConfigUtils

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ConfigUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean getBoolean​(java.util.Map<?,​?> properties, boolean defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static boolean getBoolean​(RepositorySystemSession session, boolean defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static float getFloat​(java.util.Map<?,​?> properties, float defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static float getFloat​(RepositorySystemSession session, float defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static int getInteger​(java.util.Map<?,​?> properties, int defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static int getInteger​(RepositorySystemSession session, int defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static java.util.List<?> getList​(java.util.Map<?,​?> properties, java.util.List<?> defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static java.util.List<?> getList​(RepositorySystemSession session, java.util.List<?> defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static long getLong​(java.util.Map<?,​?> properties, long defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static long getLong​(RepositorySystemSession session, long defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static java.util.Map<?,​?> getMap​(java.util.Map<?,​?> properties, java.util.Map<?,​?> defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static java.util.Map<?,​?> getMap​(RepositorySystemSession session, java.util.Map<?,​?> defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static java.lang.Object getObject​(java.util.Map<?,​?> properties, java.lang.Object defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static java.lang.Object getObject​(RepositorySystemSession session, java.lang.Object defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static java.lang.String getString​(java.util.Map<?,​?> properties, java.lang.String defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      static java.lang.String getString​(RepositorySystemSession session, java.lang.String defaultValue, java.lang.String... keys)
      Gets the specified configuration property.
      • Methods inherited from class java.lang.Object

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

      • ConfigUtils

        private ConfigUtils()
    • Method Detail

      • getObject

        public static java.lang.Object getObject​(java.util.Map<?,​?> properties,
                                                 java.lang.Object defaultValue,
                                                 java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        properties - The configuration properties to read, must not be null.
        defaultValue - The default value to return in case none of the property keys are set, may be null.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a valid value is found.
        Returns:
        The property value or null if none.
      • getObject

        public static java.lang.Object getObject​(RepositorySystemSession session,
                                                 java.lang.Object defaultValue,
                                                 java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        session - The repository system session from which to read the configuration property, must not be null.
        defaultValue - The default value to return in case none of the property keys are set, may be null.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a valid value is found.
        Returns:
        The property value or null if none.
      • getString

        public static java.lang.String getString​(java.util.Map<?,​?> properties,
                                                 java.lang.String defaultValue,
                                                 java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        properties - The configuration properties to read, must not be null.
        defaultValue - The default value to return in case none of the property keys is set to a string, may be null.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a string value is found.
        Returns:
        The property value or null if none.
      • getString

        public static java.lang.String getString​(RepositorySystemSession session,
                                                 java.lang.String defaultValue,
                                                 java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        session - The repository system session from which to read the configuration property, must not be null.
        defaultValue - The default value to return in case none of the property keys is set to a string, may be null.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a string value is found.
        Returns:
        The property value or null if none.
      • getInteger

        public static int getInteger​(java.util.Map<?,​?> properties,
                                     int defaultValue,
                                     java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        properties - The configuration properties to read, must not be null.
        defaultValue - The default value to return in case none of the property keys is set to a number.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a Number or a string representation of an Integer is found.
        Returns:
        The property value.
      • getInteger

        public static int getInteger​(RepositorySystemSession session,
                                     int defaultValue,
                                     java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        session - The repository system session from which to read the configuration property, must not be null.
        defaultValue - The default value to return in case none of the property keys is set to a number.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a Number or a string representation of an Integer is found.
        Returns:
        The property value.
      • getLong

        public static long getLong​(java.util.Map<?,​?> properties,
                                   long defaultValue,
                                   java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        properties - The configuration properties to read, must not be null.
        defaultValue - The default value to return in case none of the property keys is set to a number.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a Number or a string representation of a Long is found.
        Returns:
        The property value.
      • getLong

        public static long getLong​(RepositorySystemSession session,
                                   long defaultValue,
                                   java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        session - The repository system session from which to read the configuration property, must not be null.
        defaultValue - The default value to return in case none of the property keys is set to a number.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a Number or a string representation of a Long is found.
        Returns:
        The property value.
      • getFloat

        public static float getFloat​(java.util.Map<?,​?> properties,
                                     float defaultValue,
                                     java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        properties - The configuration properties to read, must not be null.
        defaultValue - The default value to return in case none of the property keys is set to a number.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a Number or a string representation of a Float is found.
        Returns:
        The property value.
      • getFloat

        public static float getFloat​(RepositorySystemSession session,
                                     float defaultValue,
                                     java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        session - The repository system session from which to read the configuration property, must not be null.
        defaultValue - The default value to return in case none of the property keys is set to a number.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a Number or a string representation of a Float is found.
        Returns:
        The property value.
      • getBoolean

        public static boolean getBoolean​(java.util.Map<?,​?> properties,
                                         boolean defaultValue,
                                         java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        properties - The configuration properties to read, must not be null.
        defaultValue - The default value to return in case none of the property keys is set to a boolean.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a Boolean or a string (to be parsed as boolean) is found.
        Returns:
        The property value.
      • getBoolean

        public static boolean getBoolean​(RepositorySystemSession session,
                                         boolean defaultValue,
                                         java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        session - The repository system session from which to read the configuration property, must not be null.
        defaultValue - The default value to return in case none of the property keys is set to a boolean.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a Boolean or a string (to be parsed as boolean) is found.
        Returns:
        The property value.
      • getList

        public static java.util.List<?> getList​(java.util.Map<?,​?> properties,
                                                java.util.List<?> defaultValue,
                                                java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        properties - The configuration properties to read, must not be null.
        defaultValue - The default value to return in case none of the property keys is set to a collection.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a collection is found.
        Returns:
        The property value or null if none.
      • getList

        public static java.util.List<?> getList​(RepositorySystemSession session,
                                                java.util.List<?> defaultValue,
                                                java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        session - The repository system session from which to read the configuration property, must not be null.
        defaultValue - The default value to return in case none of the property keys is set to a collection.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a collection is found.
        Returns:
        The property value or null if none.
      • getMap

        public static java.util.Map<?,​?> getMap​(java.util.Map<?,​?> properties,
                                                      java.util.Map<?,​?> defaultValue,
                                                      java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        properties - The configuration properties to read, must not be null.
        defaultValue - The default value to return in case none of the property keys is set to a map.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a map is found.
        Returns:
        The property value or null if none.
      • getMap

        public static java.util.Map<?,​?> getMap​(RepositorySystemSession session,
                                                      java.util.Map<?,​?> defaultValue,
                                                      java.lang.String... keys)
        Gets the specified configuration property.
        Parameters:
        session - The repository system session from which to read the configuration property, must not be null.
        defaultValue - The default value to return in case none of the property keys is set to a map.
        keys - The property keys to read, must not be null. The specified keys are read one after one until a map is found.
        Returns:
        The property value or null if none.