All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.catools.common.facker.provider.CFakerNameProvider Maven / Gradle / Ivy

There is a newer version: 0.1.25
Show newest version
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());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy