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 ClassesNested classes/interfaces inherited from interface org.instancio.settings.SettingKey
SettingKey.SettingKeyBuilder<T> -
Constructor Summary
ConstructorsConstructorDescriptionInternalKey(String propertyKey, Class<?> type, @Nullable Object defaultValue, @Nullable RangeAdjuster rangeAdjuster, boolean allowsNullValue) -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether the value for this key can be set tonull.<N extends Number & Comparable<N>>
voidautoAdjust(@NotNull Settings settings, N otherValue) Auto-adjusts theSettingsvalue for this key based on the value of another setting key.static <T> SettingKey.SettingKeyBuilder<T>intcompareTo(SettingKey<T> o) Default value for this key.booleaninthashCode()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:SettingKeyA unique property key identifying this setting. The property key is used to identify the setting in a properties file.- Specified by:
propertyKeyin interfaceSettingKey<T>- Returns:
- a unique property key identifying this setting
-
type
Description copied from interface:SettingKeyThe 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:
typein interfaceSettingKey<T>- Returns:
- the type of value associated with this key
-
defaultValue
Description copied from interface:SettingKeyDefault value for this key.- Specified by:
defaultValuein interfaceSettingKey<T>- Returns:
- default value, or
nullif not defined
-
allowsNullValue
public boolean allowsNullValue()Description copied from interface:SettingKeyIndicates whether the value for this key can be set tonull. Setting anullfor a key that does not acceptnullwill produce an exception.- Specified by:
allowsNullValuein interfaceSettingKey<T>- Returns:
trueifnullis allowed,falseotherwise
-
autoAdjust
public <N extends Number & Comparable<N>> void autoAdjust(@NotNull @NotNull Settings settings, @NotNull N otherValue) Description copied from interface:AutoAdjustableAuto-adjusts theSettingsvalue for this key based on the value of another setting key.- Specified by:
autoAdjustin 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:
compareToin interfaceComparable<T>
-
toString
-
builder
-