KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > gbean > GAttributeInfo


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. 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
18 package org.apache.geronimo.gbean;
19
20 import java.io.Serializable JavaDoc;
21
22 /**
23  * Describes an attibute of a GBean.
24  *
25  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
26  */

27 public class GAttributeInfo implements Serializable JavaDoc {
28     /**
29      * Name of this attribute.
30      */

31     private final String JavaDoc name;
32
33     /**
34      * Type of this attribute.
35      */

36     private final String JavaDoc type;
37
38     /**
39      * Is this attribute persistent?
40      */

41     private final boolean persistent;
42
43     /**
44      * Is this attribute manageable?
45      */

46     private final boolean manageable;
47
48     /**
49      * Is this attribute readable?
50      */

51     private final boolean readable;
52
53     /**
54      * Is this attribute writiable?
55      */

56     private final boolean writable;
57
58     /**
59      * Name of the getter method.
60      * The default is "get" + name. In the case of a defualt value we do a caseless search for the name.
61      */

62     private final String JavaDoc getterName;
63
64     /**
65      * Name of the setter method.
66      * The default is "set" + name. In the case of a defualt value we do a caseless search for the name.
67      */

68     private final String JavaDoc setterName;
69
70     public GAttributeInfo(String JavaDoc name, String JavaDoc type, boolean persistent, boolean manageable, String JavaDoc getterName, String JavaDoc setterName) {
71         this(name, type, persistent, manageable, getterName != null, setterName != null, getterName, setterName);
72     }
73
74     public GAttributeInfo(String JavaDoc name, String JavaDoc type, boolean persistent, boolean manageable, boolean readable, boolean writable, String JavaDoc getterName, String JavaDoc setterName) {
75         this.name = name;
76         this.type = type;
77         this.persistent = persistent;
78         //non persistent attributes cannot be manageable
79
this.manageable = manageable & persistent;
80         this.readable = readable;
81         this.writable = writable;
82         this.getterName = getterName;
83         this.setterName = setterName;
84     }
85
86     public String JavaDoc getName() {
87         return name;
88     }
89
90     public String JavaDoc getType() {
91         return type;
92     }
93
94     public boolean isPersistent() {
95         return persistent;
96     }
97
98     public boolean isManageable() {
99         return manageable;
100     }
101
102     public boolean isReadable() {
103         return readable;
104     }
105
106     public boolean isWritable() {
107         return writable;
108     }
109
110     public String JavaDoc getGetterName() {
111         return getterName;
112     }
113
114     public String JavaDoc getSetterName() {
115         return setterName;
116     }
117
118     public String JavaDoc toString() {
119         return "[GAttributeInfo: name=" + name +
120                 " type=" + type +
121                 " persistent=" + persistent +
122                 " manageable=" + manageable +
123                 " readable=" + readable +
124                 " writable=" + writable +
125                 " getterName=" + getterName +
126                 " setterName=" + setterName +
127                 "]";
128     }
129 }
130
Popular Tags