Package de.xima.fc.workflow
Class Setting<TValue>
java.lang.Object
de.xima.fc.workflow.Setting<TValue>
- Type Parameters:
TValue
- Type of the setting's value.
- All Implemented Interfaces:
Serializable
Generic class for a setting - a level or placement that a knob or control is set to. A settings can be though of as a
key-value pair. It consists of two parts: (a) a name for the property (the key) and (b) its current value.
Furthermore, a settings contains additional metadata, such as whether it is a required setting and requires a value to be set.
- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A builder for configuring the options of aSetting
. -
Constructor Summary
ConstructorsConstructorDescriptionSetting()
Create a new setting with the default values (editable and deletable). -
Method Summary
Modifier and TypeMethodDescriptionstatic <TValue> Setting.Builder<TValue>
builder()
static <TValue> Setting<TValue>
getName()
getValue()
boolean
boolean
boolean
boolean
static <TValue> Setting<TValue>
predefinedPassword
(String name, boolean required) static <TValue> Setting<TValue>
predefinedSetting
(String name, boolean required) void
setDeletable
(boolean deletable) void
setLocalizedDescription
(String localizedDescription) void
setLocalizedName
(String localizedName) void
void
setNameEditable
(boolean nameEditable) void
setRequired
(boolean required) void
void
setValueEditable
(boolean valueEditable) toString()
with()
-
Constructor Details
-
Setting
public Setting()Create a new setting with the default values (editable and deletable).
-
-
Method Details
-
getLocalizedDescription
- Returns:
- A localized description explaining this setting in detail.
-
getLocalizedName
- Returns:
- The localized, human-readable name of the technical
getName()
.
-
getName
- Returns:
- A technical identifier that uniquely identifies this settings. It must be unique in the context this setting is used.
- See Also:
-
getValue
- Returns:
- The current value of this settings. May be
null
to indicate absence of a value. - See Also:
-
isDeletable
public boolean isDeletable()- Returns:
- Applicable when this setting is used as part of a list of settings. When
true
, this parameter can be deleted from the list. Whenfalse
, this parameter must always be present in the list. (Although not necessary, it is strongly suggested that a setting that is not deletable be required.
-
isNameEditable
public boolean isNameEditable()- Returns:
- Whether the
getName()
may be edited by the user.false
is usually used for fixed settings that are known to exist.true
is usually used for unknown or free settings of which the user may enter any amount.
-
isRequired
public boolean isRequired()- Returns:
- Whether this settings is required, i.e. whether a
getValue()
must be set.
-
isValueEditable
public boolean isValueEditable()- Returns:
- Whether the value of this setting can be edited. Usually used for read-only properties.
-
setDeletable
public void setDeletable(boolean deletable) - Parameters:
deletable
- Applicable when this setting is used as part of a list of settings. Whentrue
, this parameter can be deleted from the list. Whenfalse
, this parameter must always be present in the list. (Although not necessary, it is strongly suggested that a setting that is not deletable be required.
-
setLocalizedDescription
- Parameters:
localizedDescription
- A localized description explaining this setting in detail.
-
setLocalizedName
- Parameters:
localizedName
- The localized, human-readable name of the technicalgetName()
.
-
setName
- Parameters:
name
- The new name for this setting.
-
setNameEditable
public void setNameEditable(boolean nameEditable) - Parameters:
nameEditable
- Whether thegetName()
may be edited by the user.false
is usually used for fixed settings that are known to exist.true
is usually used for unknown or free settings of which the user may enter any amount-
-
setRequired
public void setRequired(boolean required) - Parameters:
required
- Whether this settings is required, i.e. whether agetValue()
must be set.
-
setValue
- Parameters:
value
- The new value for this setting.
-
setValueEditable
public void setValueEditable(boolean valueEditable) - Parameters:
valueEditable
- Whether the value of this setting can be edited. Usually used for read-only properties.
-
toString
-
with
- Returns:
- A builder with the same properties as this instance. Use this builder to create a new setting instance with one or more properties changed.
-
builder
- Type Parameters:
TValue
- Type of the setting's value.- Returns:
- A new builder for configuring a setting.
-
customSetting
- Type Parameters:
TValue
- Type of the setting's value.- Returns:
- A custom setting where the user can edit both the name and the value. It is marked as required, if the user does not wish to enter a value, they should delete the setting.
-
predefinedPassword
- Type Parameters:
TValue
- Type of the setting's value.- Parameters:
name
- Name of the setting.required
- Whether the setting is required.- Returns:
- A setting for a password with a predefined name. It is not editable and cannot be deleted.
-
predefinedSetting
- Type Parameters:
TValue
- Type of the setting's value.- Parameters:
name
- Name of the setting.required
- Whether the setting is required.- Returns:
- A setting with a predefined name. It is not editable and cannot be deleted.
-