Package org.instancio.internal.settings
Class InternalKey<T>
java.lang.Object
org.instancio.internal.settings.InternalKey<T>
- All Implemented Interfaces:
Comparable<SettingKey<T>>
,AutoAdjustable
,SettingKey<T>
public final class InternalKey<T>
extends Object
implements SettingKey<T>, AutoAdjustable, Comparable<SettingKey<T>>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.instancio.settings.SettingKey
SettingKey.SettingKeyBuilder<T>
-
Constructor Summary
ConstructorDescriptionInternalKey
(String propertyKey, Class<?> type, @Nullable Object defaultValue, @Nullable RangeAdjuster rangeAdjuster, boolean allowsNullValue) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether the value for this key can be set tonull
.<N extends Number & Comparable<N>>
voidautoAdjust
(@NotNull Settings settings, N otherValue) Auto-adjusts theSettings
value for this key based on the value of another setting key.static <T> SettingKey.SettingKeyBuilder<T>
int
compareTo
(SettingKey<T> o) Default value for this key.boolean
int
hashCode()
A unique property key identifying this setting.toString()
type()
The type of value associated with this key.
-
Constructor Details
-
InternalKey
public InternalKey(String propertyKey, Class<?> type, @Nullable @Nullable Object defaultValue, @Nullable @Nullable RangeAdjuster rangeAdjuster, boolean allowsNullValue)
-
-
Method Details
-
propertyKey
Description copied from interface:SettingKey
A unique property key identifying this setting. The property key is used to identify the setting in a properties file.- Specified by:
propertyKey
in interfaceSettingKey<T>
- Returns:
- a unique property key identifying this setting
-
type
Description copied from interface:SettingKey
The type of value associated with this key.This method is used for converting a value from a string to the specified
type()
when retrieving the value fromSettings
.- Specified by:
type
in interfaceSettingKey<T>
- Returns:
- the type of value associated with this key
-
defaultValue
Description copied from interface:SettingKey
Default value for this key.- Specified by:
defaultValue
in interfaceSettingKey<T>
- Returns:
- default value, or
null
if not defined
-
allowsNullValue
public boolean allowsNullValue()Description copied from interface:SettingKey
Indicates whether the value for this key can be set tonull
. Setting anull
for a key that does not acceptnull
will produce an exception.- Specified by:
allowsNullValue
in interfaceSettingKey<T>
- Returns:
true
ifnull
is allowed,false
otherwise
-
autoAdjust
public <N extends Number & Comparable<N>> void autoAdjust(@NotNull @NotNull Settings settings, @NotNull N otherValue) Description copied from interface:AutoAdjustable
Auto-adjusts theSettings
value for this key based on the value of another setting key.- Specified by:
autoAdjust
in interfaceAutoAdjustable
- Type Parameters:
N
- a comparable number- Parameters:
settings
- to adjustotherValue
- value of the other setting to base the adjustment off
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<T>
-
toString
-
builder
-