org.catools.common.facker.provider.CFakerNameProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-randomize Show documentation
Show all versions of common-randomize Show documentation
The Common Randomize Implementation
package org.catools.common.facker.provider;
import lombok.AllArgsConstructor;
import org.catools.common.collections.CList;
import org.catools.common.facker.CRandom;
import org.catools.common.facker.model.CRandomName;
@AllArgsConstructor
public class CFakerNameProvider {
private final CList maleFirstNames;
private final CList femaleFirstNames;
private final CList maleLastNames;
private final CList femaleLastNames;
private final CList maleMiddleNames;
private final CList femaleMiddleNames;
private final CList malePrefixes;
private final CList femalePrefixes;
private final CList maleSuffixes;
private final CList femaleSuffixes;
public CRandomName getAny() {
if (CRandom.Int.next() % 3 == 0) {
return getAnyMale();
}
return getAnyFemale();
}
public CRandomName getAnyMale() {
return new CRandomName(maleFirstNames.getAny(),
maleMiddleNames.getAny(),
maleLastNames.getAny(),
malePrefixes.getAny(),
maleSuffixes.getAny());
}
public CRandomName getAnyFemale() {
return new CRandomName(femaleFirstNames.getAny(),
femaleMiddleNames.getAny(),
femaleLastNames.getAny(),
femalePrefixes.getAny(),
femaleSuffixes.getAny());
}
}