1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package javax.jdo.annotations;
18
19 import java.lang.annotation.ElementType;
20 import java.lang.annotation.Retention;
21 import java.lang.annotation.RetentionPolicy;
22 import java.lang.annotation.Target;
23
24
25 /**
26 * Annotation for the element of a collection/array relation.
27 * Corresponds to the xml element "element".
28 *
29 * @version 2.1
30 * @since 2.1
31 */
32 @Target({ElementType.FIELD, ElementType.METHOD})
33 @Retention(RetentionPolicy.RUNTIME)
34 public @interface Element
35 {
36 /**
37 * Types of the elements. This can be determined if using JDK1.5 generics
38 * but is required otherwise. Multiple types can be specified if the
39 * implementation supports multiple types.
40 * @return the types of elements
41 */
42 Class[] types() default {};
43
44 /**
45 * Whether the element is to be stored serialized (into a join table)
46 * @return whether the element is to be stored serialized
47 * (into a join table)
48 */
49 String serialized() default "";
50
51 /** Whether this element is embedded.
52 * @return whether this element is embedded
53 */
54 String embedded() default "";
55
56 /**
57 * The embedded mapping for the element.
58 * @return the embedded mapping for the element
59 */
60 Embedded[] embeddedMapping() default {};
61
62 /**
63 * Whether the element is dependent on the owner, and will be deleted
64 * when the owner is deleted.
65 * @return whether the element is dependent on the owner, and will be
66 * deleted when the owner is deleted
67 */
68 String dependent() default "";
69
70 /**
71 * Name of the table for the element.
72 * @return name of the table for the element
73 */
74 String table() default "";
75
76 /**
77 * Name of the column to store the element in.
78 * @return name of the column to store the element in
79 */
80 String column() default "";
81
82 /**
83 * Delete action to apply to any foreign key for the element.
84 * @return delete action to apply to any foreign key for the element
85 */
86 ForeignKeyAction deleteAction() default ForeignKeyAction.UNSPECIFIED;
87
88 /**
89 * Update action to apply to any foreign key for the element
90 * @return update action to apply to any foreign key for the element
91 */
92 ForeignKeyAction updateAction() default ForeignKeyAction.UNSPECIFIED;
93
94 /**
95 * Whether the value column(s) should be indexed.
96 * @return whether the value column(s) should be indexed.
97 */
98 String indexed() default "";
99
100 /** The name of the index to generate.
101 * @return the name of the index
102 */
103 String index() default "";
104
105 /**
106 * Whether a unique constraint should be generated or assumed.
107 * @return whether a unique constraint should be generated or assumed
108 */
109 String unique() default "";
110
111 /**
112 * The name of the unique key constraint to generate.
113 * @return the name of the unique key constraint
114 */
115 String uniqueKey() default "";
116
117 /**
118 * Name of the member in the target class that forms a bidirectional
119 * relationship with this member.
120 * @return name of the member in the target class that forms a bidirectional
121 * relationship with this member
122 */
123 String mappedBy() default "";
124
125 /**
126 * The column(s) for the element.
127 * @return the column(s) for the element
128 */
129 Column[] columns() default {};
130
131 /** Generate or assume a foreign key constraint exists on the column
132 * or columns associated with this join. Specify "true" or "false".
133 * @return whether to generate or assume a primary key constraint
134 */
135 String generateForeignKey() default "";
136
137 /** Name for a generated foreign key constraint.
138 * @return the name of the generated foreign key constraint
139 */
140 String foreignKey() default "";
141
142 /** Vendor extensions.
143 * @return the vendor extensions
144 */
145 Extension[] extensions() default {};
146 }