org.databene.domain.person.GivenNameGenerator Maven / Gradle / Ivy
Go to download
benerator is a framework for creating realistic and valid high-volume test data, used for
testing (unit/integration/load) and showcase setup.
Metadata constraints are imported from systems and/or configuration files. Data can imported from
and exported to files and systems, anonymized or generated from scratch. Domain packages provide
reusable generators for creating domain-specific data as names and addresses internationalizable
in language and region. It is strongly customizable with plugins and configuration options.
package org.databene.domain.person;
import java.util.Locale;
import org.databene.benerator.csv.WeightedDatasetCSVGenerator;
import org.databene.commons.Encodings;
/**
* (c) Copyright 2006 by Volker Bergmann
* Created: 09.06.2006 21:13:09
* @author Volker Bergmann
*/
public class GivenNameGenerator extends WeightedDatasetCSVGenerator {
public GivenNameGenerator() {
this(Locale.getDefault().getCountry(), Gender.MALE);
}
public GivenNameGenerator(String datasetName, Gender gender) {
this(datasetName,
"org/databene/dataset/region",
"org/databene/domain/person/givenName",
gender);
}
public GivenNameGenerator(String datasetName, String nesting, String baseName, Gender gender) {
super(genderBaseName(baseName, gender) + "_{0}.csv", datasetName, nesting, Encodings.UTF_8);
}
private static String genderBaseName(String baseName, Gender gender) {
if (gender == Gender.FEMALE)
return baseName + "_female";
else if (gender == Gender.MALE)
return baseName + "_male";
else
throw new IllegalArgumentException("Gender: " + gender);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy