com.lin.random.base.BaseRandomCreator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sql-faker Show documentation
Show all versions of sql-faker Show documentation
A lightweight SQL data creator.
package com.lin.random.base;
import com.lin.random.RandomData;
import com.lin.utils.RandomUtils;
/**
* 基础随机生成器
* @author lkmc2
* @since 1.0.0
*/
public abstract class BaseRandomCreator implements RandomData {
@Override
public T next() {
// 创建候选值数组
T[] array = createOptionsArray();
// 从数组中随机选取一个值
return RandomUtils.selectOneInArray(array);
}
/**
* 创建候选值数组
* @return 候选值数组
*/
public abstract T[] createOptionsArray();
}