FileDocCategorySizeDatePackage
Person.javaAPI DocExample888Sun Sep 08 12:49:10 BST 2002com.oreilly.javaxp.junitperf

Person.java

package com.oreilly.javaxp.junitperf;

/**
 * @author Eric M. Burke
 * @version $Id: Person.java,v 1.3 2002/09/08 17:49:11 jepc Exp $
 */
public class Person {
    private String firstName;
    private String lastName;

    public Person(String firstName, String lastName) {
        if (firstName == null && lastName == null) {
            throw new IllegalArgumentException("Both names cannot be null");
        }
        this.firstName = firstName;
        this.lastName = lastName;
    }

    public String getFullName() {
        String first = (this.firstName != null) ? this.firstName : "?";
        String last = (this.lastName != null) ? this.lastName : "?";

        return first + " " + last;
    }

    public String getFirstName() {
        return this.firstName;
    }

    public String getLastName() {
        return this.lastName;
    }
}