Package com.solibri.smc.api.settings
Interface Setting<T>
- 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
View
s 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 T
getDefaultValue()
Defines the default value that the setting has when it is first introduced to the software.default String
getDescription()
The internationalized description of the setting.default String
getName()
The internationalized name of the setting.String
getUniqueId()
The unique ID of the setting.T
getValue()
Returns the current value of the setting.Optional<String>
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
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
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
Sets the value of the setting.- Parameters:
value
- the value to be set- Since:
- 9.10.8
-
invalidReason
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
-