Package org.instancio.internal.settings
Class InternalSettings
java.lang.Object
org.instancio.internal.settings.InternalSettings
- All Implemented Interfaces:
Settings
-
Method Summary
Modifier and TypeMethodDescriptionstatic InternalSettingscreate()Creates a new instance of empty settings.static InternalSettingsdefaults()Creates a new instance containing default settings.static InternalSettingsCreate settings from the given map.static InternalSettingsCreate settings from the given settings.<T> Tget(@NotNull SettingKey<T> key) Get setting value for given key.Returns a read-only view of the subtype map.lock()Locks these settings for further modifications, making this instance immutable.Maps the supertypefromsupertype to 'to' subtype.Creates a new instance of settings by merging given settings with these settings.<T> InternalSettingsset(@NotNull SettingKey<T> key, T value) Set the setting with the given key to the specified value.toString()
-
Method Details
-
create
Description copied from interface:SettingsCreates a new instance of empty settings.- Returns:
- a new instance of empty settings
-
defaults
Description copied from interface:SettingsCreates a new instance containing default settings.- Returns:
- a new instance of settings containing the defaults
-
from
Description copied from interface:SettingsCreate settings from the given map.- Parameters:
map- to create settings from- Returns:
- a new instance of settings created from the given map
-
from
Description copied from interface:SettingsCreate settings from the given settings.- Parameters:
other- settings to create settings from- Returns:
- a new instance of settings
-
merge
Description copied from interface:SettingsCreates a new instance of settings by merging given settings with these settings. -
get
Description copied from interface:SettingsGet setting value for given key. -
set
Description copied from interface:SettingsSet the setting with the given key to the specified value.Note: when updating range settings (such as
Keys.COLLECTION_MIN_SIZEandKeys.COLLECTION_MAX_SIZE), range bounds are auto-adjusted byConstants.RANGE_ADJUSTMENT_PERCENTAGEif the new minimum is higher than the current maximum, and vice versa. -
mapType
public InternalSettings mapType(@NotNull @NotNull Class<?> type, @NotNull @NotNull Class<?> subtype) Description copied from interface:SettingsMaps the supertypefromsupertype to 'to' subtype.Example:
Settings settings = Settings.create() .mapType(Animal.class, Dog.class); Animal animal = Instancio.of(Animal.class) .withSettings(settings) .create(); assertThat(animal).isExactlyInstanceOf(Dog.class); -
getSubtypeMap
Description copied from interface:SettingsReturns a read-only view of the subtype map.- Specified by:
getSubtypeMapin interfaceSettings- Returns:
- subtype map
-
lock
Description copied from interface:SettingsLocks these settings for further modifications, making this instance immutable. -
toString
-