KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > beanutils > priv > PrivateBean


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
17
18 package org.apache.commons.beanutils.priv;
19
20
21 /**
22  * Bean that has a private constructor that exposes properties via
23  * various mechanisms (based on property name):
24  * <ul>
25  * <li><strong>foo</strong> - Via direct public method
26  * <li><strong>bar</strong> - Via directly implemented interface
27  * <li><strong>baz</strong> - Via indirectly implemented interface
28  * </ul>
29  *
30  * @author Craig R. McClanahan
31  * @version $Revision: 1.6 $ $Date: 2004/02/28 13:18:37 $
32  */

33
34 class PrivateBean implements PrivateDirect {
35
36
37     // ----------------------------------------------------------- Constructors
38

39
40     /**
41      * Package private constructor - can only use factory method to create
42      * beans.
43      */

44     PrivateBean() {
45
46         super();
47
48     }
49
50
51     // ------------------------------------------------------------- Properties
52

53
54     /**
55      * A directly implemented property.
56      */

57     private String JavaDoc foo = "This is foo";
58
59     public String JavaDoc getFoo() {
60
61         return (this.foo);
62
63     }
64
65
66     /**
67      * A property accessible via a directly implemented interface.
68      */

69     private String JavaDoc bar = "This is bar";
70
71     public String JavaDoc getBar() {
72
73         return (this.bar);
74
75     }
76
77
78     /**
79      * A method accessible via a directly implemented interface.
80      */

81     public String JavaDoc methodBar(String JavaDoc in) {
82
83         return (in);
84
85     }
86
87
88     /**
89      * A property accessible via an indirectly implemented interface.
90      */

91     private String JavaDoc baz = "This is baz";
92
93     public String JavaDoc getBaz() {
94
95         return (this.baz);
96
97     }
98
99
100     /**
101      * A method accessible via an indirectly implemented interface.
102      */

103     public String JavaDoc methodBaz(String JavaDoc in) {
104
105         return (in);
106
107     }
108
109
110 }
111
Popular Tags