Package org.instancio.settings
Class Keys
java.lang.Object
org.instancio.settings.Keys
Defines all keys supported by Instancio.
- Since:
- 1.1.10
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SettingKey<AfterGenerate>Specifies the default value of theAfterGeneratehint supplied from custom generators to the engine; default isAfterGenerate.POPULATE_NULLS_AND_DEFAULT_PRIMITIVES; property namehint.after.generate.static final SettingKey<Boolean>Specifies whether anullcan be generated for array elements; default isfalse; property namearray.elements.nullable.static final SettingKey<Integer>Specifies maximum length for arrays; default is 6; property namearray.max.length.static final SettingKey<Integer>Specifies minimum length for arrays; default is 2; property namearray.min.length.static final SettingKey<Boolean>Specifies whether a null can be generated for arrays; default isfalse; property namearray.nullable.static final SettingKey<AssignmentType>Specifies how to assign values via reflection, using fields or methods; default isAssignmentType.FIELD; property nameassignment.type.static final SettingKey<Boolean>Specifies whether values should be generated based on Jakarta Bean Validation 3.0 annotations, if present; default isfalse; property namebean.validation.api.enabled.static final SettingKey<Boolean>Specifies whether anullcan be generated for Boolean type; default isfalse; property nameboolean.nullable.static final SettingKey<Byte>Specifies maximum value for bytes; default is 127; property namebyte.max.static final SettingKey<Byte>Specifies minimum value for bytes; default is 1; property namebyte.min.static final SettingKey<Boolean>Specifies whether anullcan be generated for Byte type; default isfalse; property namebyte.nullable.static final SettingKey<Boolean>Specifies whether anullcan be generated for Character type; default isfalse; property namecharacter.nullable.static final SettingKey<Boolean>Specifies whether anullcan be generated for collection elements; default isfalse; property namecollection.elements.nullable.static final SettingKey<Integer>Specifies maximum size for collections; default is 6; property namecollection.max.size.static final SettingKey<Integer>Specifies minimum size for collections; default is 2; property namecollection.min.size.static final SettingKey<Boolean>Specifies whether anullcan be generated for collections; default isfalse; property namecollection.nullable.static final SettingKey<Double>Specifies maximum value for doubles; default is 10000; property namedouble.max.static final SettingKey<Double>Specifies minimum value for doubles; default is 1; property namedouble.min.static final SettingKey<Boolean>Specifies whether anullcan be generated for Double type; default isfalse; property namedouble.nullable.static final SettingKey<Float>Specifies maximum value for floats; default is 10000; property namefloat.max.static final SettingKey<Float>Specifies minimum value for floats; default is 1; property namefloat.min.static final SettingKey<Boolean>Specifies whether anullcan be generated for Float type; default isfalse; property namefloat.nullable.static final SettingKey<Integer>Specifies maximum value for integers; default is 10000; property nameinteger.max.static final SettingKey<Integer>Specifies minimum value for integers; default is 1; property nameinteger.min.static final SettingKey<Boolean>Specifies whether anullcan be generated for Integer type; default isfalse; property nameinteger.nullable.static final SettingKey<Long>Specifies maximum value for longs; default is 10000; property namelong.max.static final SettingKey<Long>Specifies minimum value for longs; default is 1; property namelong.min.static final SettingKey<Boolean>Specifies whether anullcan be generated for Long type; default isfalse; property namelong.nullable.static final SettingKey<Boolean>Specifies whether anullcan be generated for map keys; default isfalse; property namemap.keys.nullable.static final SettingKey<Integer>Specifies maximum size for maps; default is 6; property namemap.max.size.static final SettingKey<Integer>Specifies minimum size for maps; default is 2; property namemap.min.size.static final SettingKey<Boolean>Specifies whether anullcan be generated for maps; default isfalse; property namemap.nullable.static final SettingKey<Boolean>Specifies whether anullcan be generated for map values; default isfalse; property namemap.values.nullable.static final SettingKey<Integer>Specifies the maximum depth of the generated object tree; default is8; property namemax.depth.static final SettingKey<Mode>Specifies the mode: strict (unused selectors will trigger an exception) or lenient; default isMode.STRICT; property namemode.static final SettingKey<OnSetFieldError>Specifies what should happen if an error occurs setting a field's value; default isOnSetFieldError.IGNORE; property nameon.set.field.error.static final SettingKey<OnSetMethodError>Specifies what should happen if an error occurs invoking a setter; default isOnSetMethodError.ASSIGN_FIELD; property nameon.set.method.error.static final SettingKey<OnSetMethodNotFound>Specifies what should happen if a setter method for a field cannot be resolved; default isOnSetMethodNotFound.ASSIGN_FIELD; property nameon.set.method.not.found.static final SettingKey<Boolean>Specifies whether initialised fields are allowed to be overwritten; default istrue; property nameoverwrite.existing.values.static final SettingKey<Long>Specifies the seed value; default isnull; property nameseed.static final SettingKey<SetterStyle>Indicates the naming convention of setter methods to use; default isSetterStyle.SET; property namesetter.style.static final SettingKey<Short>Specifies maximum value for shorts; default is 10000; property nameshort.max.static final SettingKey<Short>Specifies minimum value for shorts; default is 1; property nameshort.min.static final SettingKey<Boolean>Specifies whether anullcan be generated for Short type; default isfalse; property nameshort.nullable.static final SettingKey<Boolean>Specifies whether an empty string can be generated; default isfalse; property namestring.allow.empty.static final SettingKey<Boolean>Specifies whether generated Strings should be prefixed with field names; default isfalse; property namestring.field.prefix.enabled.static final SettingKey<Integer>Specifies maximum length of strings; default is 10; property namestring.max.length.static final SettingKey<Integer>Specifies minimum length of strings; default is 3; property namestring.min.length.static final SettingKey<Boolean>Specifies whether anullcan be generated for String type; default isfalse; property namestring.nullable. -
Method Summary
Modifier and TypeMethodDescriptionstatic List<SettingKey<Object>>all()Returns all keys supported by Instancio.static <T> SettingKey<T>Returns aSettingKeyinstance with the given property key.static <T> SettingKey.SettingKeyBuilder<T>A builder for creating custom setting keys.
-
Field Details
-
ARRAY_ELEMENTS_NULLABLE
Specifies whether anullcan be generated for array elements; default isfalse; property namearray.elements.nullable. -
ARRAY_MAX_LENGTH
Specifies maximum length for arrays; default is 6; property namearray.max.length. -
ARRAY_MIN_LENGTH
Specifies minimum length for arrays; default is 2; property namearray.min.length. -
ARRAY_NULLABLE
Specifies whether a null can be generated for arrays; default isfalse; property namearray.nullable. -
BOOLEAN_NULLABLE
Specifies whether anullcan be generated for Boolean type; default isfalse; property nameboolean.nullable. -
BYTE_MAX
Specifies maximum value for bytes; default is 127; property namebyte.max. -
BYTE_MIN
Specifies minimum value for bytes; default is 1; property namebyte.min. -
BYTE_NULLABLE
Specifies whether anullcan be generated for Byte type; default isfalse; property namebyte.nullable. -
CHARACTER_NULLABLE
Specifies whether anullcan be generated for Character type; default isfalse; property namecharacter.nullable. -
COLLECTION_ELEMENTS_NULLABLE
Specifies whether anullcan be generated for collection elements; default isfalse; property namecollection.elements.nullable. -
COLLECTION_MAX_SIZE
Specifies maximum size for collections; default is 6; property namecollection.max.size. -
COLLECTION_MIN_SIZE
Specifies minimum size for collections; default is 2; property namecollection.min.size. -
COLLECTION_NULLABLE
Specifies whether anullcan be generated for collections; default isfalse; property namecollection.nullable. -
DOUBLE_MAX
Specifies maximum value for doubles; default is 10000; property namedouble.max. -
DOUBLE_MIN
Specifies minimum value for doubles; default is 1; property namedouble.min. -
DOUBLE_NULLABLE
Specifies whether anullcan be generated for Double type; default isfalse; property namedouble.nullable. -
FLOAT_MAX
Specifies maximum value for floats; default is 10000; property namefloat.max. -
FLOAT_MIN
Specifies minimum value for floats; default is 1; property namefloat.min. -
FLOAT_NULLABLE
Specifies whether anullcan be generated for Float type; default isfalse; property namefloat.nullable. -
INTEGER_MAX
Specifies maximum value for integers; default is 10000; property nameinteger.max. -
INTEGER_MIN
Specifies minimum value for integers; default is 1; property nameinteger.min. -
INTEGER_NULLABLE
Specifies whether anullcan be generated for Integer type; default isfalse; property nameinteger.nullable. -
LONG_MAX
Specifies maximum value for longs; default is 10000; property namelong.max. -
LONG_MIN
Specifies minimum value for longs; default is 1; property namelong.min. -
LONG_NULLABLE
Specifies whether anullcan be generated for Long type; default isfalse; property namelong.nullable. -
MAP_KEYS_NULLABLE
Specifies whether anullcan be generated for map keys; default isfalse; property namemap.keys.nullable. -
MAP_MAX_SIZE
Specifies maximum size for maps; default is 6; property namemap.max.size. -
MAP_MIN_SIZE
Specifies minimum size for maps; default is 2; property namemap.min.size. -
MAP_NULLABLE
Specifies whether anullcan be generated for maps; default isfalse; property namemap.nullable. -
MAP_VALUES_NULLABLE
Specifies whether anullcan be generated for map values; default isfalse; property namemap.values.nullable. -
MODE
Specifies the mode: strict (unused selectors will trigger an exception) or lenient; default isMode.STRICT; property namemode.- Since:
- 1.3.3
- See Also:
-
AFTER_GENERATE_HINT
Specifies the default value of theAfterGeneratehint supplied from custom generators to the engine; default isAfterGenerate.POPULATE_NULLS_AND_DEFAULT_PRIMITIVES; property namehint.after.generate.- Since:
- 2.0.0
- See Also:
-
OVERWRITE_EXISTING_VALUES
Specifies whether initialised fields are allowed to be overwritten; default istrue; property nameoverwrite.existing.values.- Since:
- 2.0.0
-
ASSIGNMENT_TYPE
Specifies how to assign values via reflection, using fields or methods; default isAssignmentType.FIELD; property nameassignment.type.- Since:
- 2.1.0
- See Also:
-
ON_SET_FIELD_ERROR
Specifies what should happen if an error occurs setting a field's value; default isOnSetFieldError.IGNORE; property nameon.set.field.error.- Since:
- 2.1.0
- See Also:
-
ON_SET_METHOD_ERROR
Specifies what should happen if an error occurs invoking a setter; default isOnSetMethodError.ASSIGN_FIELD; property nameon.set.method.error.- Since:
- 2.1.0
- See Also:
-
ON_SET_METHOD_NOT_FOUND
Specifies what should happen if a setter method for a field cannot be resolved; default isOnSetMethodNotFound.ASSIGN_FIELD; property nameon.set.method.not.found.- Since:
- 2.1.0
- See Also:
-
SETTER_STYLE
Indicates the naming convention of setter methods to use; default isSetterStyle.SET; property namesetter.style.- Since:
- 2.1.0
- See Also:
-
BEAN_VALIDATION_ENABLED
Specifies whether values should be generated based on Jakarta Bean Validation 3.0 annotations, if present; default isfalse; property namebean.validation.api.enabled.- Since:
- 2.7.0
-
MAX_DEPTH
Specifies the maximum depth of the generated object tree; default is8; property namemax.depth.- Since:
- 2.7.0
-
SEED
Specifies the seed value; default isnull; property nameseed.- Since:
- 1.5.1
-
SHORT_MAX
Specifies maximum value for shorts; default is 10000; property nameshort.max. -
SHORT_MIN
Specifies minimum value for shorts; default is 1; property nameshort.min. -
SHORT_NULLABLE
Specifies whether anullcan be generated for Short type; default isfalse; property nameshort.nullable. -
STRING_ALLOW_EMPTY
Specifies whether an empty string can be generated; default isfalse; property namestring.allow.empty. -
STRING_MAX_LENGTH
Specifies maximum length of strings; default is 10; property namestring.max.length. -
STRING_MIN_LENGTH
Specifies minimum length of strings; default is 3; property namestring.min.length. -
STRING_NULLABLE
Specifies whether anullcan be generated for String type; default isfalse; property namestring.nullable. -
STRING_FIELD_PREFIX_ENABLED
Specifies whether generated Strings should be prefixed with field names; default isfalse; property namestring.field.prefix.enabled.- Since:
- 2.4.0
-
-
Method Details
-
all
Returns all keys supported by Instancio.- Returns:
- all keys
-
get
Returns aSettingKeyinstance with the given property key.- Parameters:
key- to lookup- Returns:
- the setting key, or
nullif none found
-
ofType
A builder for creating custom setting keys.When defining custom keys, specifying
SettingKey.SettingKeyBuilder.withPropertyKey(String)is optional since not all settings will be defined in a properties file. IfwithPropertyKey()is not specified, then a random property key will be assigned.- Type Parameters:
T- the value type- Parameters:
type- of the value the key is associated with, notnull- Returns:
- key builder
- Since:
- 2.12.0
-