KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > betwixt > digester > IDBean


1
2 /*
3  * Copyright 2001-2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.commons.betwixt.digester;
18
19 import java.util.ArrayList JavaDoc;
20 import java.util.List JavaDoc;
21
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;
24
25 /** Bean for testing ID-IDRef reading.
26   *
27   * @author Robert Burrell Donkin
28   * @version $Revision: 1.7 $
29   */

30 public class IDBean {
31     
32     static Log log = LogFactory.getLog( IDBean.class );
33     
34     private String JavaDoc id;
35     private String JavaDoc name;
36     
37     private IDBean child;
38     
39     private List JavaDoc children = new ArrayList JavaDoc();
40     
41     public IDBean() { log.debug("Created"); }
42     
43     public IDBean(String JavaDoc id, String JavaDoc name) {
44         setId(id);
45         setName(name);
46     }
47     
48     public String JavaDoc getId() {
49         return id;
50     }
51     
52     public void setId(String JavaDoc id) {
53         this.id = id;
54     }
55     
56     public String JavaDoc getName() {
57         return name;
58     }
59     
60     public void setName(String JavaDoc name) {
61         log.debug("Set name: " + name);
62         this.name = name;
63     }
64
65     public List JavaDoc getChildren() {
66         return children;
67     }
68     
69     public void addChild(IDBean child) {
70         log.debug("Added child " + child + " to bean " + this);
71         children.add(child);
72     }
73     
74     public String JavaDoc toString() {
75         return "IDBean[name=" + getName() + ",id=" + getId() + ", children=" + children.size() + "] " + super.toString();
76     }
77 }
78
Popular Tags