Class SystemProperty<T>

  • Type Parameters:
    T - The type of system property.

    public final class SystemProperty<T>
    extends Object
    Represents a system property - also accessible via JiveGlobals. The only way to create a SystemProperty object is to use a SystemProperty.Builder.
    • Method Detail

      • getProperties

        public static Collection<SystemProperty> getProperties()
        Returns:
        an unmodifiable collection of all the current SystemProperties
      • removePropertiesForPlugin

        public static void removePropertiesForPlugin​(String plugin)
        Removes all the properties for a specific plugin. This should be called by a plugin when it is unloaded to allow it to be added again without a server restart
        Parameters:
        plugin - The plugin for which properties should be removed
      • getProperty

        public static Optional<SystemProperty> getProperty​(String key)
        Returns the SystemProperty for the specified key
        Parameters:
        key - the key for the property to fetch
        Returns:
        The SystemProperty for that key, if any
      • getValue

        public T getValue()
        Returns:
        the current value of the SystemProperty, or the default value if it is not currently set to within the configured constraints. null if the property has not been set and there is no default value.
      • getValueAsSaved

        public String getValueAsSaved()
        Returns:
        the value of this property as saved in the ofProperty table. null if there is no current value and the default is not set.
      • getDisplayValue

        public String getDisplayValue()
        Returns:
        the value a human readable value of this property. null if there is no current value and the default is not set.
      • hasValueChanged

        public boolean hasValueChanged()
        Returns:
        false if the property has been changed from it's default value, otherwise true
      • getDefaultDisplayValue

        public String getDefaultDisplayValue()
        Returns:
        the value a human readable value of this property. null if the default value is not configured.
      • setValue

        public void setValue​(T value)
        Sets the value of the SystemProperty. Note that the new value can be outside any minimum/maximum for the property, and will be saved to the database as such, however subsequent attempts to retrieve it's value will return the default.
        Parameters:
        value - the new value for the SystemProperty
      • getPlugin

        public String getPlugin()
        Returns:
        the plugin that created this property - or simply "Openfire"
      • isDynamic

        public boolean isDynamic()
        Returns:
        false if Openfire or the plugin needs to be restarted for changes to this property to take effect, otherwise true
      • isEncrypted

        public boolean isEncrypted()
        Returns:
        true if the property was initially setup to be encrypted, or was encrypted subsequently, otherwise false
      • isRestartRequired

        public boolean isRestartRequired()
        Returns:
        true if this property has changed and an Openfire or plugin restart is required, otherwise false
      • addListener

        public void addListener​(Consumer<T> listener)
        Parameters:
        listener - a listener to add to the property, that will be called whenever the property value changes
      • removeListener

        public void removeListener​(Consumer<T> listener)
        Parameters:
        listener - the listener that is no longer required
      • getDescription

        public String getDescription()
        Returns:
        the description of this property. This is set in the resource bundle for the current locale, using the key system_property.property-key.
      • getDefaultValue

        public T getDefaultValue()
        Returns:
        the default value of this property. null if there is no default value configured.