1 package org.jaxen.javabean; 2 3 import java.util.Set ; 4 import java.util.HashSet ; 5 6 class Person 7 { 8 private String name; 9 private int age; 10 11 private Set brothers; 12 13 Person(String name, int age) 14 { 15 this.name = name; 16 this.age = age; 17 this.brothers = new HashSet (); 18 } 19 20 public String getName() 21 { 22 return this.name; 23 } 24 25 public int getAge() 26 { 27 return this.age; 28 } 29 30 public void addBrother(Person brother) 31 { 32 this.brothers.add( brother ); 33 } 34 35 public Set getBrothers() 36 { 37 return this.brothers; 38 } 39 40 public String toString() 41 { 42 return "[Person: " + this.name + "]"; 43 } 44 } 45 | Popular Tags |