KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > pojo > test > NetworkNode


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.cache.pojo.test;
8
9 import java.util.ArrayList JavaDoc;
10 import java.util.List JavaDoc;
11
12 /**
13  * Usually corresponds to the physical machine that comparises of various devices.
14  * <p>This object is used to illustrate the pojo cache capability of PojoCache. Note the absence of <code>Serializable</code>
15  * interface.</p>
16  *
17  * @author <a HREF="mailto:ben.wang@jboss.com">Ben Wang</a>
18  */

19 // We are using JDK1.5 annotation.
20
@org.jboss.cache.pojo.annotation.Replicable
21 public class NetworkNode
22 {
23    String JavaDoc name_;
24    List JavaDoc elements_;
25    String JavaDoc ipAddress_;
26
27    public String JavaDoc getName()
28    {
29       return name_;
30    }
31
32    public void setName(String JavaDoc name)
33    {
34       name_ = name;
35    }
36
37    public List JavaDoc getElements()
38    {
39       return elements_;
40    }
41
42    protected void setElements(List JavaDoc elements)
43    {
44       elements_ = elements;
45    }
46
47    public void addElement(NetworkElement element)
48    {
49       if (elements_ == null)
50          elements_ = new ArrayList JavaDoc();
51
52       elements_.add(element);
53       element.setParentNode(this);
54    }
55
56    public String JavaDoc getIpAddress()
57    {
58       return ipAddress_;
59    }
60
61    public void setIpAddress(String JavaDoc ipAddress)
62    {
63       ipAddress_ = ipAddress;
64    }
65
66    public String JavaDoc toString()
67    {
68       StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
69       sb.append(" name= ").append(getName()).append(" ipAddress= ").append(getIpAddress());
70       sb.append(" elements=").append(getElements());
71       return sb.toString();
72    }
73
74 }
75
Popular Tags