This is a library to generate random localized names consuming the API of uinames as source.
Download the JAR file and its dependencies (see below) and import them to your project.
At the time this library was written, this was the dependencies used to work with it.
First of all import the library classes into your project:
importname.davidsanchez.uiname.*;Then create an instance of the UIName class:
UINameuiName = newUIName();This way, you will use the default parameters. You can modify parameters this way:
UINameuiName = newUIName()
.setAmount(2) // Amount of names you want to generate
.setGender(Constants.Gender.FEMALE) // Gender of the names you want to generate
.setCountry(Constants.Country.COLOMBIA); // Localization of the names you want to generateThen, you can use the generateNames() method, it will ask you to implement the UINameResponse interface:
uiName.generateNames(newUINameResponse() {
@OverridepublicvoidonNamesReceived(Person[] people) {
// The parameter people have all the generated people names in their // corresponding class.for (Personperson : people) {
System.out.println("Name: " + p.getName() + "\nSurname: " + p.getSurname() +
"\nCountry: " + p.getCountry() +
"\nGender: " + p.getGender());
}
}
});