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
@ValidSetting public final class Setting<TValue> extends Object implements 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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Setting.Builder<TValue>
A builder for configuring the options of aSetting
.
-
Constructor Summary
Constructors Constructor Description Setting()
Create a new setting with the default values (editable and deletable).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <TValue> Setting.Builder<TValue>
builder()
Setting<TValue>
copy()
Creates a copy of this setting.static <TValue> Setting<TValue>
customSetting()
String
getLocalizedDescription()
String
getLocalizedName()
String
getName()
TValue
getValue()
boolean
isDeletable()
boolean
isNameEditable()
boolean
isRequired()
boolean
isValueEditable()
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
setName(String name)
void
setNameEditable(boolean nameEditable)
void
setRequired(boolean required)
void
setValue(TValue value)
void
setValueEditable(boolean valueEditable)
String
toString()
Setting.Builder<TValue>
with()
-
-
-
Method Detail
-
getLocalizedDescription
public String getLocalizedDescription()
- Returns:
- A localized description explaining this setting in detail.
-
getLocalizedName
public String getLocalizedName()
- Returns:
- The localized, human-readable name of the technical
getName()
.
-
getName
public String getName()
- Returns:
- A technical identifier that uniquely identifies this settings. It must be unique in the context this setting is used.
- See Also:
getLocalizedName()
-
getValue
public TValue getValue()
- Returns:
- The current value of this settings. May be
null
to indicate absence of a value. - See Also:
isRequired()
-
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
public void setLocalizedDescription(String localizedDescription)
- Parameters:
localizedDescription
- A localized description explaining this setting in detail.
-
setLocalizedName
public void setLocalizedName(String localizedName)
- Parameters:
localizedName
- The localized, human-readable name of the technicalgetName()
.
-
setName
public void setName(String name)
- 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
public void setValue(TValue value)
- 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.
-
copy
public Setting<TValue> copy()
Creates a copy of this setting.- Returns:
- A new setting with the same properties as this instance.
-
with
public Setting.Builder<TValue> 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
public static <TValue> Setting.Builder<TValue> builder()
- Type Parameters:
TValue
- Type of the setting's value.- Returns:
- A new builder for configuring a setting.
-
customSetting
public static <TValue> Setting<TValue> 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
public static <TValue> Setting<TValue> predefinedPassword(String name, boolean required)
- 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
public static <TValue> Setting<TValue> predefinedSetting(String name, boolean required)
- 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.
-
-