31
32 /**
33 * The Resource annotation marks a resource that is needed
34 * by the application. This annotation may be applied to an
35 * application component class, or to fields or methods of the
36 * component class. When the annotation is applied to a
37 * field or method, the container will inject an instance
38 * of the requested resource into the application component
39 * when the component is initialized. If the annotation is
40 * applied to the component class, the annotation declares a
41 * resource that the application will look up at runtime. <p>
42 *
43 * Even though this annotation is not marked Inherited, deployment
44 * tools are required to examine all superclasses of any component
45 * class to discover all uses of this annotation in all superclasses.
46 * All such annotation instances specify resources that are needed
47 * by the application component. Note that this annotation may
48 * appear on private fields and methods of superclasses; the container
49 * is required to perform injection in these cases as well.
50 *
51 * @since Common Annotations 1.0
52 */
53 @Target({TYPE, FIELD, METHOD})
54 @Retention(RUNTIME)
55 public @interface Resource {
56 /**
57 * The JNDI name of the resource. For field annotations,
58 * the default is the field name. For method annotations,
59 * the default is the JavaBeans property name corresponding
60 * to the method. For class annotations, there is no default
61 * and this must be specified.
62 */
63 String name() default "";
64
65 /**
66 * The name of the resource that the reference points to. It can
67 * link to any compatible resource using the global JNDI names.
68 *
69 * @since Common Annotations 1.1
70 */
71
72 String lookup() default "";
73
74 /**
75 * The Java type of the resource. For field annotations,
76 * the default is the type of the field. For method annotations,
77 * the default is the type of the JavaBeans property.
78 * For class annotations, there is no default and this must be
79 * specified.
80 */
81 Class<?> type() default java.lang.Object.class;
82
83 /**
84 * The two possible authentication types for a resource.
85 */
86 enum AuthenticationType {
87 CONTAINER,
88 APPLICATION
89 }
|
31
32 /**
33 * The Resource annotation marks a resource that is needed
34 * by the application. This annotation may be applied to an
35 * application component class, or to fields or methods of the
36 * component class. When the annotation is applied to a
37 * field or method, the container will inject an instance
38 * of the requested resource into the application component
39 * when the component is initialized. If the annotation is
40 * applied to the component class, the annotation declares a
41 * resource that the application will look up at runtime. <p>
42 *
43 * Even though this annotation is not marked Inherited, deployment
44 * tools are required to examine all superclasses of any component
45 * class to discover all uses of this annotation in all superclasses.
46 * All such annotation instances specify resources that are needed
47 * by the application component. Note that this annotation may
48 * appear on private fields and methods of superclasses; the container
49 * is required to perform injection in these cases as well.
50 *
51 * @since 1.6, Common Annotations 1.0
52 */
53 @Target({TYPE, FIELD, METHOD})
54 @Retention(RUNTIME)
55 public @interface Resource {
56 /**
57 * The JNDI name of the resource. For field annotations,
58 * the default is the field name. For method annotations,
59 * the default is the JavaBeans property name corresponding
60 * to the method. For class annotations, there is no default
61 * and this must be specified.
62 */
63 String name() default "";
64
65 /**
66 * The name of the resource that the reference points to. It can
67 * link to any compatible resource using the global JNDI names.
68 *
69 * @since 1.7, Common Annotations 1.1
70 */
71
72 String lookup() default "";
73
74 /**
75 * The Java type of the resource. For field annotations,
76 * the default is the type of the field. For method annotations,
77 * the default is the type of the JavaBeans property.
78 * For class annotations, there is no default and this must be
79 * specified.
80 */
81 Class<?> type() default java.lang.Object.class;
82
83 /**
84 * The two possible authentication types for a resource.
85 */
86 enum AuthenticationType {
87 CONTAINER,
88 APPLICATION
89 }
|