Class PropertyRegistry


  • public class PropertyRegistry
    extends Object
    The registry of the ActiveViam properties.

    This class was created to standardize how the properties are configured. Now a component needing to read the value of a property does not impose how it is set (with system property, environment property, Spring environment...).

    By default, this class only retrieve properties defined as system or environment properties. To take into account properties defined in the Spring environment, one need to import SpringPropertyResolverConfig in the Spring Configuration.

    Author:
    ActiveViam
    • Method Detail

      • getString

        public static String getString​(ActiveViamProperty prop,
                                       String defaultValue)
        Gets the value of the property or defaultValue if it is not defined.
        Parameters:
        prop - the property to resolve
        defaultValue - the default value to return if no value is found
        Returns:
        the value of the property or defaultValue if it is not defined
      • getString

        public static String getString​(ActiveViamProperty prop)
        Gets the value of the property or null if it is not defined.
        Parameters:
        prop - the property to resolve
        Returns:
        the value of the property or null if it is not defined
      • getBoolean

        public static boolean getBoolean​(ActiveViamProperty prop,
                                         boolean defaultValue)
        Gets the value of the property or defaultValue if it is not defined.
        Parameters:
        prop - the property to resolve
        defaultValue - the default value to return if no value is found
        Returns:
        the value of the property or defaultValue if it is not defined
      • getInteger

        public static int getInteger​(ActiveViamProperty prop,
                                     int defaultValue)
        Gets the value of the property or defaultValue if it is not defined.
        Parameters:
        prop - the property to resolve
        defaultValue - the default value to return if no value is found
        Returns:
        the value of the property or defaultValue if it is not defined
      • getDouble

        public static double getDouble​(ActiveViamProperty prop,
                                       double defaultValue)
        Gets the value of the property or defaultValue if it is not defined.
        Parameters:
        prop - the property to resolve
        defaultValue - the default value to return if no value is found
        Returns:
        the value of the property or defaultValue if it is not defined
      • getLong

        public static long getLong​(ActiveViamProperty prop,
                                   long defaultValue)
        Gets the value of the property or defaultValue if it is not defined.
        Parameters:
        prop - the property to resolve
        defaultValue - the default value to return if no value is found
        Returns:
        the value of the property or defaultValue if it is not defined
      • set

        public static void set​(ActiveViamProperty prop,
                               Object value)
        Sets the value of a property.
        Parameters:
        prop - the property to set in the registry
        value - value to set in the registry
      • clear

        public static void clear​(ActiveViamProperty prop)
        Resets the value of a property.
        Parameters:
        prop - the property to clear