T
- the type of system property to buildpublic static final class SystemProperty.Builder<T> extends Object
SystemProperty
Modifier and Type | Method and Description |
---|---|
SystemProperty.Builder<T> |
addListener(Consumer<T> listener) |
SystemProperty<T> |
build()
Validates the details of the SystemProperty, and generates one if it's valid.
|
<C> SystemProperty<List<C>> |
buildList(Class<C> listType) |
<C> SystemProperty<Set<C>> |
buildSet(Class<C> listType) |
static <T> SystemProperty.Builder<T> |
ofType(Class<T> clazz)
Start a new SystemProperty builder.
|
SystemProperty.Builder<T> |
setBaseClass(Class<?> baseClass)
This indicates which class configured values must inherit from.
|
SystemProperty.Builder<T> |
setChronoUnit(ChronoUnit chronoUnit)
If the type of the property is a
Duration this is used to indicate how the value is saved in the
database. |
SystemProperty.Builder<T> |
setDefaultValue(T defaultValue)
Sets the default value for the SystemProperty.
|
SystemProperty.Builder<T> |
setDynamic(boolean dynamic) |
SystemProperty.Builder<T> |
setEncrypted(boolean encrypted) |
SystemProperty.Builder<T> |
setKey(String key)
Sets the key for the SystemProperty.
|
SystemProperty.Builder<T> |
setMaxValue(T maxValue)
Sets the maximum value for the SystemProperty.
|
SystemProperty.Builder<T> |
setMinValue(T minValue)
Sets the minimum value for the SystemProperty.
|
SystemProperty.Builder<T> |
setPlugin(String plugin)
Sets the name of the plugin that is associated with this property.
|
SystemProperty.Builder<T> |
setSorted(boolean sorted) |
public static <T> SystemProperty.Builder<T> ofType(Class<T> clazz)
String
Integer
- for which a default value must be supplied using setDefaultValue(Object)
Long
- for which a default value must be suppliedBoolean
- for which a default value must be suppliedDuration
- for which a ChronoUnit
must be specified, to indicate how the value will be saved, using setChronoUnit(ChronoUnit)
Instant
JID
Class
- for which a base class must be specified from which values must inherit, using setBaseClass(Class)
Enum
- for which a default value must be suppliedList
- for which a collection type must be specified, using buildList(Class)
Set
- for which a collection type must be specified, using buildSet(Class)
T
- the type of SystemPropertyclazz
- The class of property being builtpublic SystemProperty.Builder<T> setKey(String key)
key
- the property keypublic SystemProperty.Builder<T> setDefaultValue(T defaultValue)
defaultValue
- the default value for the propertysetMinValue(Object)
,
setMaxValue(Object)
public SystemProperty.Builder<T> setBaseClass(Class<?> baseClass)
baseClass
- - the base class from which all configured values must inheritpublic SystemProperty.Builder<T> setMinValue(T minValue)
Important: If a minimum value is configured, the type of property being built must
implement Comparable
.
minValue
- the minimum value for the propertypublic SystemProperty.Builder<T> setMaxValue(T maxValue)
Important: If a maximum value is configured, the type of property being built must
implement Comparable
.
maxValue
- the maximum value for the propertypublic SystemProperty.Builder<T> setChronoUnit(ChronoUnit chronoUnit)
Duration
this is used to indicate how the value is saved in the
database. For an example a Duration of one hour will be saved as "60" if the ChronoUnit is ChronoUnit.MINUTES
, or
saved as "3600" if the ChronoUnit is ChronoUnit.SECONDS
.
Important: The ChronoUnit is required, and must be set, if the type of property is a Duration.
chronoUnit
- the unit of time the Duration is saved to the database inpublic SystemProperty.Builder<T> addListener(Consumer<T> listener)
listener
- the listener that will be called when the value of the property changespublic SystemProperty.Builder<T> setDynamic(boolean dynamic)
dynamic
- true
if changes to this property take effect immediately, false
if a restart
is required.public SystemProperty.Builder<T> setEncrypted(boolean encrypted)
encrypted
- true
if this property should be encrypted, false
if can be stored in
plain text. Defaults to plain text if not otherwise specified.public SystemProperty.Builder<T> setSorted(boolean sorted)
sorted
- true
if this property is a list and should be sorted, false
otherwise.public SystemProperty.Builder<T> setPlugin(String plugin)
plugin
- the name of the plugin creating this property.public SystemProperty<T> build() throws IllegalArgumentException
IllegalArgumentException
- if incorrect arguments have been supplied to the builderpublic <C> SystemProperty<List<C>> buildList(Class<C> listType)
public <C> SystemProperty<Set<C>> buildSet(Class<C> listType)
Copyright © 2003–2019 Ignite Realtime. All rights reserved.