View Javadoc

1   package com.bm.ejb3metadata.annotations.impl;
2   
3   import javax.annotation.Resource.AuthenticationType;
4   
5   
6   /**
7    * Acts as an implementation of @{@link javax.annotation.Resource} annotation.
8    * @author Daniel Wiese
9    */
10  public class JAnnotationResource {
11  
12      /**
13       * Name.
14       */
15      private String name = null;
16  
17      /**
18       * Type (class).
19       */
20      private String type = null;
21  
22      /**
23       * Authentication type.
24       */
25      private AuthenticationType authenticationType = null;
26  
27      /**
28       * Shareable (true/false).
29       */
30      private boolean shareable;
31  
32      /**
33       * Description.
34       */
35      private String description = null;
36  
37      /**
38       * mapped name.
39       */
40      private String mappedName = null;
41  
42      /**
43       * Constructor.<br>
44       * Build object with default values.
45       */
46      public JAnnotationResource() {
47          // set default values
48          this.name = "";
49          this.type = "java/lang/Object";
50          this.authenticationType = AuthenticationType.CONTAINER;
51          shareable = true;
52          description = "";
53      }
54  
55      /**
56       * @return Name (resource to be looked up).
57       */
58      public String getName() {
59          return name;
60      }
61  
62      /**
63       * Sets Name (resource to be looked up).
64       * @param name the given name.
65       */
66      public void setName(final String name) {
67          this.name = name;
68      }
69  
70  
71      /**
72       * @return the authentication type.
73       */
74      public AuthenticationType getAuthenticationType() {
75          return authenticationType;
76      }
77  
78  
79      /**
80       * Sets the authentication type.
81       * @param authenticationType value to set.
82       */
83      public void setAuthenticationType(final AuthenticationType authenticationType) {
84          this.authenticationType = authenticationType;
85      }
86  
87  
88      /**
89       * @return the description.
90       */
91      public String getDescription() {
92          return description;
93      }
94  
95  
96      /**
97       * Sets the description.
98       * @param description value to set.
99       */
100     public void setDescription(final String description) {
101         this.description = description;
102     }
103 
104 
105     /**
106      * @return true if it is shareable.
107      */
108     public boolean isShareable() {
109         return shareable;
110     }
111 
112 
113     /**
114      * Sets the shareable attribute (false/true).
115      * @param shareable a boolean.
116      */
117     public void setShareable(final boolean shareable) {
118         this.shareable = shareable;
119     }
120 
121 
122     /**
123      * @return the type of resource (class).
124      */
125     public String getType() {
126         return type;
127     }
128 
129 
130     /**
131      * Sets the class type of this object.
132      * @param type the class value (as string format).
133      */
134     public void setType(final String type) {
135         this.type = type;
136     }
137 
138     /**
139      * @return MappedName.
140      */
141     public String getMappedName() {
142         return mappedName;
143     }
144 
145     /**
146      * Sets mapped Name.
147      * @param mappedName the given mappedName.
148      */
149     public void setMappedName(final String mappedName) {
150         this.mappedName = mappedName;
151     }
152 
153     /**
154      * @return string representation
155      */
156     @Override
157     public String toString() {
158         StringBuilder sb = new StringBuilder();
159         // classname
160         sb.append(this.getClass().getName().substring(this.getClass().getPackage().getName().length() + 1));
161 
162         // name
163         sb.append("[name=");
164         sb.append(name);
165 
166         // type
167         sb.append(", type=");
168         sb.append(type);
169 
170         // Authentication type
171         sb.append(", authenticationType=");
172         sb.append(authenticationType);
173 
174         // Shareable
175         sb.append(", shareable=");
176         sb.append(shareable);
177 
178         // Description
179         sb.append(", description=");
180         sb.append(description);
181 
182         // MappedName
183         sb.append(", mappedName=");
184         sb.append(mappedName);
185 
186         sb.append("]");
187         return sb.toString();
188     }
189 
190 }