Package org.instancio.internal.settings
Class InternalSettings
java.lang.Object
org.instancio.internal.settings.InternalSettings
- All Implemented Interfaces:
Settings
-
Method Summary
Modifier and TypeMethodDescriptionstatic InternalSettings
create()
Creates a new instance of empty settings.static InternalSettings
defaults()
Creates a new instance containing default settings.static InternalSettings
Create settings from the given map.static InternalSettings
Create settings from the given settings.<T> T
get
(@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 supertypefrom
supertype to 'to' subtype.Creates a new instance of settings by merging given settings with these settings.<T> InternalSettings
set
(SettingKey<T> key, T value) Set the setting with the given key to the specified value.toString()
-
Method Details
-
create
Description copied from interface:Settings
Creates a new instance of empty settings.- Returns:
- a new instance of empty settings
-
defaults
Description copied from interface:Settings
Creates a new instance containing default settings.- Returns:
- a new instance of settings containing the defaults
-
from
Description copied from interface:Settings
Create 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:Settings
Create settings from the given settings.- Parameters:
other
- settings to create settings from- Returns:
- a new instance of settings
-
merge
Description copied from interface:Settings
Creates a new instance of settings by merging given settings with these settings. -
get
Description copied from interface:Settings
Get setting value for given key. -
set
Description copied from interface:Settings
Set the setting with the given key to the specified value.Note: when updating range settings (such as
Keys.COLLECTION_MIN_SIZE
andKeys.COLLECTION_MAX_SIZE
), range bounds are auto-adjusted byConstants.RANGE_ADJUSTMENT_PERCENTAGE
if 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:Settings
Maps the supertypefrom
supertype 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:Settings
Returns a read-only view of the subtype map.- Specified by:
getSubtypeMap
in interfaceSettings
- Returns:
- subtype map
-
lock
Description copied from interface:Settings
Locks these settings for further modifications, making this instance immutable. -
toString
-