Skip to content
This repository has been archived by the owner on Feb 14, 2021. It is now read-only.

d4vsanchez/uinames-java

Repository files navigation

uinames for Java

This is a library to generate random localized names consuming the API of uinames as source.

Installation

Download the JAR file and its dependencies (see below) and import them to your project.

Dependencies

At the time this library was written, this was the dependencies used to work with it.

Using uinames-java

First of all import the library classes into your project:

import name.davidsanchez.uiname.*;

Then create an instance of the UIName class:

UIName uiName = new UIName();

This way, you will use the default parameters. You can modify parameters this way:

UIName uiName = new UIName()
    .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 generate

Then, you can use the generateNames() method, it will ask you to implement the UINameResponse interface:

uiName.generateNames(new UINameResponse() {
    @Override
    public void onNamesReceived(Person[] people) {
		// The parameter people have all the generated people names in their 
		// corresponding class.
        for (Person person : people) {
        	System.out.println("Name: " + p.getName() + 
                "\nSurname: " + p.getSurname() +
                "\nCountry: " + p.getCountry() +
                "\nGender: " + p.getGender());
        }
    }
});

About

Java library to consume uinames API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages