1 package org.hibernate.auction; 3 4 7 public class Name { 8 private String firstName; 9 private String lastName; 10 private Character initial; 11 private Name() {} 12 public Name(String first, Character middle, String last) { 13 firstName = first; 14 initial = middle; 15 lastName = last; 16 } 17 public String getFirstName() { 18 return firstName; 19 } 20 21 public void setFirstName(String firstName) { 22 this.firstName = firstName; 23 } 24 25 public Character getInitial() { 26 return initial; 27 } 28 29 public void setInitial(Character initial) { 30 this.initial = initial; 31 } 32 33 public String getLastName() { 34 return lastName; 35 } 36 37 public void setLastName(String lastName) { 38 this.lastName = lastName; 39 } 40 41 public String toString() { 42 StringBuffer buf = new StringBuffer () 43 .append(firstName) 44 .append(' '); 45 if (initial!=null) buf.append(initial) 46 .append(' '); 47 return buf.append(lastName) 48 .toString(); 49 } 50 51 } 52 | Popular Tags |