io.javarig.generator.StringGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-random-generator Show documentation
Show all versions of java-random-generator Show documentation
This project aims to provide a random instances generator for any class in java, it iterates through setters of an empty object and sets the fields values (using Java reflection api) randomly
The newest version!
package io.javarig.generator;
import io.javarig.RandomInstanceGenerator;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.RandomStringUtils;
import java.lang.reflect.Type;
@Setter
@Getter
public class StringGenerator extends TypeGenerator {
public StringGenerator(Type type, RandomInstanceGenerator randomInstanceGenerator) {
super(type, randomInstanceGenerator);
}
@Override
public String generate() {
return RandomStringUtils.randomAlphanumeric(getConfig().getMinSizeInclusive(), getConfig().getMaxSizeExclusive());
}
}