1 package org.hibernate.test.exception; 3 4 import java.util.Set ; 5 6 11 public class Group { 12 private Long id; 13 private String name; 14 private Set members; 15 16 public Long getId() { 17 return id; 18 } 19 20 public void setId(Long id) { 21 this.id = id; 22 } 23 24 public String getName() { 25 return name; 26 } 27 28 public void setName(String name) { 29 this.name = name; 30 } 31 32 public Set getMembers() { 33 return members; 34 } 35 36 public void setMembers(Set members) { 37 this.members = members; 38 } 39 40 public void addMember(User member) { 41 if (member == null) { 42 throw new IllegalArgumentException ("Member to add cannot be null"); 43 } 44 45 this.members.add(member); 46 member.getMemberships().add(this); 47 } 48 } 49 | Popular Tags |