KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > deployment > annotations > impl > JAnnotationResource


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: JAnnotationResource.java 413 2006-04-25 16:55:33Z benoitf $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.easybeans.deployment.annotations.impl;
27
28 import javax.annotation.Resource.AuthenticationType;
29
30
31 /**
32  * Acts as an implementation of @{@link javax.annotation.Resource} annotation.
33  * @author Florent Benoit
34  */

35 public class JAnnotationResource {
36
37     /**
38      * Name.
39      */

40     private String JavaDoc name = null;
41
42     /**
43      * Type (class).
44      */

45     private String JavaDoc type = null;
46
47     /**
48      * Authentication type.
49      */

50     private AuthenticationType authenticationType = null;
51
52     /**
53      * Shareable (true/false).
54      */

55     private boolean shareable;
56
57     /**
58      * Description.
59      */

60     private String JavaDoc description = null;
61
62     /**
63      * mapped name.
64      */

65     private String JavaDoc mappedName = null;
66
67     /**
68      * Constructor.<br>
69      * Build object with default values.
70      */

71     public JAnnotationResource() {
72         // set default values
73
this.name = "";
74         this.type = "java/lang/Object";
75         this.authenticationType = AuthenticationType.CONTAINER;
76         shareable = true;
77         description = "";
78     }
79
80     /**
81      * @return Name (resource to be looked up).
82      */

83     public String JavaDoc getName() {
84         return name;
85     }
86
87     /**
88      * Sets Name (resource to be looked up).
89      * @param name the given name.
90      */

91     public void setName(final String JavaDoc name) {
92         this.name = name;
93     }
94
95
96     /**
97      * @return the authentication type.
98      */

99     public AuthenticationType getAuthenticationType() {
100         return authenticationType;
101     }
102
103
104     /**
105      * Sets the authentication type.
106      * @param authenticationType value to set.
107      */

108     public void setAuthenticationType(final AuthenticationType authenticationType) {
109         this.authenticationType = authenticationType;
110     }
111
112
113     /**
114      * @return the description.
115      */

116     public String JavaDoc getDescription() {
117         return description;
118     }
119
120
121     /**
122      * Sets the description.
123      * @param description value to set.
124      */

125     public void setDescription(final String JavaDoc description) {
126         this.description = description;
127     }
128
129
130     /**
131      * @return true if it is shareable.
132      */

133     public boolean isShareable() {
134         return shareable;
135     }
136
137
138     /**
139      * Sets the shareable attribute (false/true).
140      * @param shareable a boolean.
141      */

142     public void setShareable(final boolean shareable) {
143         this.shareable = shareable;
144     }
145
146
147     /**
148      * @return the type of resource (class).
149      */

150     public String JavaDoc getType() {
151         return type;
152     }
153
154
155     /**
156      * Sets the class type of this object.
157      * @param type the class value (as string format).
158      */

159     public void setType(final String JavaDoc type) {
160         this.type = type;
161     }
162
163     /**
164      * @return MappedName.
165      */

166     public String JavaDoc getMappedName() {
167         return mappedName;
168     }
169
170     /**
171      * Sets mapped Name.
172      * @param mappedName the given mappedName.
173      */

174     public void setMappedName(final String JavaDoc mappedName) {
175         this.mappedName = mappedName;
176     }
177
178     /**
179      * @return string representation
180      */

181     @Override JavaDoc
182     public String JavaDoc toString() {
183         StringBuilder JavaDoc sb = new StringBuilder JavaDoc();
184         // classname
185
sb.append(this.getClass().getName().substring(this.getClass().getPackage().getName().length() + 1));
186
187         // name
188
sb.append("[name=");
189         sb.append(name);
190
191         // type
192
sb.append(", type=");
193         sb.append(type);
194
195         // Authentication type
196
sb.append(", authenticationType=");
197         sb.append(authenticationType);
198
199         // Shareable
200
sb.append(", shareable=");
201         sb.append(shareable);
202
203         // Description
204
sb.append(", description=");
205         sb.append(description);
206
207         // MappedName
208
sb.append(", mappedName=");
209         sb.append(mappedName);
210
211         sb.append("]");
212         return sb.toString();
213     }
214
215 }
216
Popular Tags