001: package com.bm.ejb3metadata.annotations.impl;
002:
003: import javax.annotation.Resource.AuthenticationType;
004:
005: /**
006: * Acts as an implementation of @{@link javax.annotation.Resource} annotation.
007: * @author Daniel Wiese
008: */
009: public class JAnnotationResource {
010:
011: /**
012: * Name.
013: */
014: private String name = null;
015:
016: /**
017: * Type (class).
018: */
019: private String type = null;
020:
021: /**
022: * Authentication type.
023: */
024: private AuthenticationType authenticationType = null;
025:
026: /**
027: * Shareable (true/false).
028: */
029: private boolean shareable;
030:
031: /**
032: * Description.
033: */
034: private String description = null;
035:
036: /**
037: * mapped name.
038: */
039: private String mappedName = null;
040:
041: /**
042: * Constructor.<br>
043: * Build object with default values.
044: */
045: public JAnnotationResource() {
046: // set default values
047: this .name = "";
048: this .type = "java/lang/Object";
049: this .authenticationType = AuthenticationType.CONTAINER;
050: shareable = true;
051: description = "";
052: }
053:
054: /**
055: * @return Name (resource to be looked up).
056: */
057: public String getName() {
058: return name;
059: }
060:
061: /**
062: * Sets Name (resource to be looked up).
063: * @param name the given name.
064: */
065: public void setName(final String name) {
066: this .name = name;
067: }
068:
069: /**
070: * @return the authentication type.
071: */
072: public AuthenticationType getAuthenticationType() {
073: return authenticationType;
074: }
075:
076: /**
077: * Sets the authentication type.
078: * @param authenticationType value to set.
079: */
080: public void setAuthenticationType(
081: final AuthenticationType authenticationType) {
082: this .authenticationType = authenticationType;
083: }
084:
085: /**
086: * @return the description.
087: */
088: public String getDescription() {
089: return description;
090: }
091:
092: /**
093: * Sets the description.
094: * @param description value to set.
095: */
096: public void setDescription(final String description) {
097: this .description = description;
098: }
099:
100: /**
101: * @return true if it is shareable.
102: */
103: public boolean isShareable() {
104: return shareable;
105: }
106:
107: /**
108: * Sets the shareable attribute (false/true).
109: * @param shareable a boolean.
110: */
111: public void setShareable(final boolean shareable) {
112: this .shareable = shareable;
113: }
114:
115: /**
116: * @return the type of resource (class).
117: */
118: public String getType() {
119: return type;
120: }
121:
122: /**
123: * Sets the class type of this object.
124: * @param type the class value (as string format).
125: */
126: public void setType(final String type) {
127: this .type = type;
128: }
129:
130: /**
131: * @return MappedName.
132: */
133: public String getMappedName() {
134: return mappedName;
135: }
136:
137: /**
138: * Sets mapped Name.
139: * @param mappedName the given mappedName.
140: */
141: public void setMappedName(final String mappedName) {
142: this .mappedName = mappedName;
143: }
144:
145: /**
146: * @return string representation
147: */
148: @Override
149: public String toString() {
150: StringBuilder sb = new StringBuilder();
151: // classname
152: sb.append(this .getClass().getName().substring(
153: this .getClass().getPackage().getName().length() + 1));
154:
155: // name
156: sb.append("[name=");
157: sb.append(name);
158:
159: // type
160: sb.append(", type=");
161: sb.append(type);
162:
163: // Authentication type
164: sb.append(", authenticationType=");
165: sb.append(authenticationType);
166:
167: // Shareable
168: sb.append(", shareable=");
169: sb.append(shareable);
170:
171: // Description
172: sb.append(", description=");
173: sb.append(description);
174:
175: // MappedName
176: sb.append(", mappedName=");
177: sb.append(mappedName);
178:
179: sb.append("]");
180: return sb.toString();
181: }
182:
183: }
|