Interface Setting<T>

Type Parameters:
T - the type of the setting, usually Integer, String or Boolean
All Known Implementing Classes:
BooleanSetting, DoubleSetting, IntegerSetting, PasswordSetting, StringSetting

public interface Setting<T>
Setting defines a setting for the application. 3rd party developers can implement this interface to be able to have their custom settings visible in the UI, usable in their other 3rd party components, such as Views and handled automatically by Solibri. It is not normal to implement this interface. Usually developers should extend the abstract classes that implement this.
Since:
9.10.8
  • Method Summary

    Modifier and Type
    Method
    Description
    Defines the default value that the setting has when it is first introduced to the software.
    default String
    The internationalized description of the setting.
    default String
    The internationalized name of the setting.
    The unique ID of the setting.
    Returns the current value of the setting.
    invalidReason​(T value)
    This method is implemented to define valid values for this setting.
    void
    setValue​(T value)
    Sets the value of the setting.
  • Method Details

    • getUniqueId

      String getUniqueId()
      The unique ID of the setting. This needs to be globally unique.
      Returns:
      the ID of the setting
      Since:
      9.10.8
    • getName

      default String getName()
      The internationalized name of the setting. The default implementation returns value based on properties files value with key "NAME". Returns the ID of the setting if no property is found.
      Returns:
      the name of the view
      Since:
      9.10.8
    • getDescription

      default String getDescription()
      The internationalized description of the setting. The default implementation returns value based on properties files value with key "DESCRIPTION". Returns the name of the setting if no property is found.
      Returns:
      the name of the view
      Since:
      9.10.8
    • getValue

      T getValue()
      Returns the current value of the setting. This returns the new value of the setting immediately after it has been changed, but note that it is up to the users of settings to decide if the new value takes effect immediately or after a restart.
      Returns:
      the value
      Since:
      9.10.8
    • getDefaultValue

      T getDefaultValue()
      Defines the default value that the setting has when it is first introduced to the software.
      Returns:
      the default value
    • setValue

      void setValue(T value)
      Sets the value of the setting.
      Parameters:
      value - the value to be set
      Since:
      9.10.8
    • invalidReason

      Optional<String> invalidReason(T value)
      This method is implemented to define valid values for this setting. For example, for an integer valued setting, only positive integers might be valid values. If the given value is invalid, the method should return the reason for it being invalid. In the given value is valid, Optional.empty() should be returned.
      Parameters:
      value - the value to be checked for validity
      Returns:
      true if the given value is valid, false otherwise