1 25 26 package org.objectweb.speedo.tutorial.pobjects.mapping; 27 28 import java.util.ArrayList ; 29 import java.util.Collection ; 30 import java.util.Iterator ; 31 32 35 public class Project { 36 37 private String title; 38 private Collection employees; 39 40 public Project(String title) { 41 this.title = title; 42 employees = new ArrayList (); 43 } 44 45 public Collection getEmployees() { 46 return employees; 47 } 48 public void setEmployees(Collection employees) { 49 this.employees = employees; 50 } 51 public void addEmployee(Employee employee){ 52 employees.add(employee); 53 } 54 55 public String getTitle() { 56 return title; 57 } 58 public void setTitle(String title) { 59 this.title = title; 60 } 61 62 public String toString(){ 63 String s = "Title: " + title + ", Employees:["; 64 Iterator it = employees.iterator(); 65 while(it.hasNext()){ 66 Employee e = (Employee) it.next(); 67 s += e.getName() + ", "; 68 } 69 s = s.substring(0, s.length()-2); 70 s += "]"; 71 return s; 72 } 73 } 74 | Popular Tags |