KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jaxen > javabean > Person


1 package org.jaxen.javabean;
2
3 import java.util.Set JavaDoc;
4 import java.util.HashSet JavaDoc;
5
6 class Person
7 {
8     private String JavaDoc name;
9     private int age;
10
11     private Set JavaDoc brothers;
12
13     Person(String JavaDoc name, int age)
14     {
15         this.name = name;
16         this.age = age;
17         this.brothers = new HashSet JavaDoc();
18     }
19
20     public String JavaDoc 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 JavaDoc getBrothers()
36     {
37         return this.brothers;
38     }
39
40     public String JavaDoc toString()
41     {
42         return "[Person: " + this.name + "]";
43     }
44 }
45
Popular Tags