Package ru.objectsfill.object_param
Class Extend
java.lang.Object
ru.objectsfill.object_param.Extend
Per-field parameter override for customizing how individual fields are populated.
Allows setting custom collection sizes, value lengths, and mutation functions
that target specific fields by name, by class type, or apply globally.
Example:
Extend.field("name").addMutationFunction(n -> "Custom").gen()
Extend.clazz(String.class).valueLength(20).gen()
Extend.wrapByFunction(obj -> transform(obj)).gen()
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classFluent builder for constructingExtendinstances. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionStarts building anExtendthat targets all fields of a specific class type.Starts building anExtendthat targets a specific field by name.Class<?>getClazz()Returns the class type used for field matching.Returns the custom collection size for this field.Returns the mutation function applied to generated values.Returns the field name used for matching.Returns the custom value length for this field.wrapByFunction(UnaryOperator<Object> singleChangeFunction) Starts building anExtendwith a global mutation function applied to every generated value (when no field name or class is specified).
-
Constructor Details
-
Extend
public Extend(String fieldName, Integer collectionSize, Integer valueLength, UnaryOperator<Object> singleChangeFunction, Class<?> clazz) Constructs a new Extend with all parameters.- Parameters:
fieldName- the target field name (ornull)collectionSize- the collection size override (ornull)valueLength- the value length override (ornull)singleChangeFunction- the mutation function (ornull)clazz- the target class type (ornull)
-
-
Method Details
-
getClazz
Returns the class type used for field matching.- Returns:
- the class type, or
nullif matching by field name
-
getFieldChangeFunction
Returns the mutation function applied to generated values.- Returns:
- the mutation function, or
nullif none is set
-
getFieldName
Returns the field name used for matching.- Returns:
- the field name, or
nullif matching by class type
-
getCollectionSize
Returns the custom collection size for this field.- Returns:
- the collection size override, or
nullto use the default
-
getValueLength
Returns the custom value length for this field.- Returns:
- the value length override, or
nullto use the default
-
field
Starts building anExtendthat targets a specific field by name.- Parameters:
fieldName- the name of the field to customize- Returns:
- a new builder
-
clazz
Starts building anExtendthat targets all fields of a specific class type.- Parameters:
clazz- the class type to match fields against- Returns:
- a new builder
-
wrapByFunction
public static Extend.FillFieldParametersBuilder wrapByFunction(UnaryOperator<Object> singleChangeFunction) Starts building anExtendwith a global mutation function applied to every generated value (when no field name or class is specified).- Parameters:
singleChangeFunction- the mutation function- Returns:
- a new builder
-