KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > betwixt > dotbetwixt > ExampleBean


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

16 package org.apache.commons.betwixt.dotbetwixt;
17
18 import java.util.ArrayList JavaDoc;
19 import java.util.List JavaDoc;
20
21 /**
22   * Bean that has a property that is typed to an interface
23   *
24   * @author Robert Burrell Donkin
25   */

26 public class ExampleBean {
27     
28     private String JavaDoc name;
29     private List JavaDoc examples = new ArrayList JavaDoc();
30     
31     public ExampleBean() {}
32     public ExampleBean(String JavaDoc name) {
33         setName(name);
34     }
35     
36     public String JavaDoc getName() {
37         return name;
38     }
39     
40     public void setName(String JavaDoc name) {
41         this.name = name;
42     }
43     
44     public List JavaDoc getExamples() {
45         return examples;
46     }
47     
48     public void addExample(IExample example) {
49         examples.add(example);
50     }
51     
52     
53     public String JavaDoc toString() {
54         return "[" + this.getClass().getName() + ": name=" + name + ", examples="
55                 + examples + "]";
56     }
57     
58     public boolean equals( Object JavaDoc obj ) {
59         if ( obj == null ) return false;
60         return this.hashCode() == obj.hashCode();
61     }
62     
63     public int hashCode() {
64         return toString().hashCode();
65     }
66 }
67
68
Popular Tags