Class AutoFill.Builder<T>
java.lang.Object
cloud.opencode.base.test.data.AutoFill.Builder<T>
- Type Parameters:
T- the target type | 目标类型
- Enclosing class:
AutoFill
Builder for configuring and creating auto-filled instances.
用于配置和创建自动填充实例的构建器。
- Since:
- JDK 25, opencode-base-test V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a single auto-filled instance.list(int count) Builds a list of auto-filled instances.maxDepth(int depth) Sets the maximum recursion depth for nested objects.seed(long seed) Sets the random seed for deterministic generation.Overrides a specific field with the given value.
-
Method Details
-
seed
Sets the random seed for deterministic generation. 设置随机种子以进行确定性生成。- Parameters:
seed- the random seed | 随机种子- Returns:
- this builder | 此构建器
-
with
Overrides a specific field with the given value. 使用给定值覆盖特定字段。Note: overrides only apply to the top-level object and are NOT propagated to nested Records or POJOs.
注意: 覆盖仅适用于顶层对象,不会传递到嵌套的Record或POJO。
- Parameters:
fieldName- the field/component name | 字段/组件名称value- the value to set | 要设置的值- Returns:
- this builder | 此构建器
- Throws:
NullPointerException- if fieldName is null | 当字段名为空时抛出
-
maxDepth
Sets the maximum recursion depth for nested objects. 设置嵌套对象的最大递归深度。- Parameters:
depth- the maximum depth (must be positive) | 最大深度(必须为正数)- Returns:
- this builder | 此构建器
- Throws:
IllegalArgumentException- if depth is not positive | 当深度不是正数时抛出
-
build
Builds a single auto-filled instance. 构建单个自动填充的实例。- Returns:
- the auto-filled instance | 自动填充的实例
- Throws:
DataGenerationException- if instance creation fails | 当实例创建失败时抛出
-
list
Builds a list of auto-filled instances. 构建自动填充实例的列表。- Parameters:
count- the number of instances to create (must be positive) | 要创建的实例数量(必须为正数)- Returns:
- the list of auto-filled instances | 自动填充实例的列表
- Throws:
IllegalArgumentException- if count is not positive | 当数量不是正数时抛出DataGenerationException- if instance creation fails | 当实例创建失败时抛出
-