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()
        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
        plugin - The plugin for which properties should be removed
      • getProperty

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

        public T getValue()
        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()
        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()
        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()
        false if the property has been changed from it's default value, otherwise true
      • getDefaultDisplayValue

        public String getDefaultDisplayValue()
        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.
        value - the new value for the SystemProperty
      • getPlugin

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

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

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

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

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

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

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

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