com.claritysys.data
Class NameGenerator

java.lang.Object
  extended by com.claritysys.data.NameGenerator

public class NameGenerator
extends java.lang.Object

Class to generate random but reasonable people names, both male and female.

To use, create an instance of NameGenerator and invoke nextName() one or more times. Unlike some of the other random data generators which return a single String, NameGenerator returns a NameGenerator.Name object which allows you to access the component parts of the name.

Example usage:

   NameGenerator gen = new NameGenerator ();
   for (int i = 0; i < count; i++) {
       System.out.println (gen.nextName ());
       System.out.println ();
   }
 

Output from above code:

   MR PERRY J BOOKER
   TITLE: MANAGER
   DPT:   MANAGEMENT INFORMATION SYSTEMS
   EMAIL: pbooker@companyname.com

   MS PAT COURTNEY JACOBSON
   TITLE: VP
   DPT:   INFORMATION TECHNOLOGY
   EMAIL: pjacobson@companyname.com

   MRS NANCY S MCCORMICK DDS
   TITLE: SR VICE PRESIDENT
   DPT:   ENGINEERING
   EMAIL: nmccormick@companyname.com
 

The names, titles, and departments are constructed from lists which are hard-coded as String arrays in this program. If somebody feels inspired they could move them to a resource file ....

Version:
$Revision: 2348 $

Nested Class Summary
static class NameGenerator.Name
          A single generated name with its component parts.
static class NameGenerator.Test
          Inner class for testing.
 
Constructor Summary
NameGenerator()
           
 
Method Summary
static java.lang.String[] getDepartments()
           
static java.lang.String[] getFemaleFirstNames()
           
static java.lang.String[] getLastNames()
           
static java.lang.String[] getMaleFirstNames()
           
static java.lang.String[] getSuffixes()
           
static java.lang.String[] getTitles()
           
 NameGenerator.Name nextName()
          Return the next random name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NameGenerator

public NameGenerator()
Method Detail

nextName

public NameGenerator.Name nextName()
Return the next random name.

Returns:
the next random name.

getMaleFirstNames

public static java.lang.String[] getMaleFirstNames()

getFemaleFirstNames

public static java.lang.String[] getFemaleFirstNames()

getLastNames

public static java.lang.String[] getLastNames()

getSuffixes

public static java.lang.String[] getSuffixes()

getTitles

public static java.lang.String[] getTitles()

getDepartments

public static java.lang.String[] getDepartments()


Copyright ? 2002 Clarity Systems Group, LLC. All Rights Reserved.