KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > javabean > SimpleBean


1 package test.javabean;
2
3 /**
4  * Example of a JavaBean with tags to generate the associated BeanInfo class.
5  *
6  * @javabean.class
7  * displayName="Simple Bean"
8  * name="SimpleBean"
9  * shortDescription="Simple example of JavaBean BeanInfo generation"
10  *
11  * @javabean.icons
12  * color16="/toolbarButtonGraphics/general/Stop16.gif"
13  *
14  * @javabean.attribute
15  * name="literal"
16  * value="A sample attribute"
17  *
18  * @javabean.attribute
19  * name="expression"
20  * value="new StringBuffer()"
21  * rtexpr="true"
22  */

23 public class SimpleBean {
24     /** An int field. */
25     protected int count = 0;
26     /** A boolean field. */
27     protected boolean flag = false;
28     /** A String field. */
29     protected String JavaDoc name = "";
30     /** A Class field. */
31     protected Class JavaDoc parent = null;
32
33     /** Constructs a new SimpleBean. */
34     public SimpleBean() {
35     }
36
37     /**
38      * The first method
39      *
40      * @javabean.method
41      * displayName="My First Method"
42      * name="myFirstMethod"
43      * shortDescription="Example of method without parameters"
44      */

45     public void myFirstMethod() {
46     }
47
48     /**
49      * The second method
50      *
51      * @param param1 Description of the Parameter 1
52      * @param param2 Description of the Parameter 2
53      *
54      * @javabean.method
55      * displayName="My Second Method"
56      * name="mySecondMethod"
57      * shortDescription="Example of method with parameters"
58      *
59      * @javabean.param
60      * class="java.lang.String"
61      * displayName="Parameter 1"
62      * name="param1"
63      *
64      * @javabean.param
65      * class="boolean"
66      * displayName="Parameter 2"
67      * name="param2"
68      */

69     public void mySecondMethod(String JavaDoc param1, boolean param2) {
70     }
71     /**
72      * @javabean.property displayName="Class" bound="true" hidden="false" shortDescription="Class of the entry"
73      */

74     public boolean isFlag() {
75         return flag;
76     }
77     
78     public void setFlag(boolean flag) {
79         this.flag = flag;
80     }
81     
82     
83     public String JavaDoc getName() {
84         return name;
85     }
86     /**
87      * @javabean.property displayName="Name" shortDescription="Name of the entry"
88      */

89     public void setName(String JavaDoc name) {
90         this.name = name;
91     }
92     
93     /**
94      * @javabean.property displayName="Message(s)" shortDescription="Number of messages in Queue"
95      * readOnly="true"
96      */

97     public int getCount() {
98         return count;
99     }
100     /**
101      * @javabean.property displayName="Full Path"
102      * shortDescription="Absolute path of the context"
103      */

104     public Class JavaDoc getParent() {
105         return parent;
106     }
107 }
Popular Tags