1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package com.enspire.gemini.annotation;
25
26 import java.lang.annotation.ElementType;
27 import java.lang.annotation.Retention;
28 import java.lang.annotation.RetentionPolicy;
29 import java.lang.annotation.Target;
30
31 /***
32 * <p><a href="http://www.e-nspire.com">e-nspire site</a></p>
33 * Field annotated as <code>@BidirectionalOne</code> represent simple
34 * bidirectional fields. Bidirectional properties are JavaBean properties
35 * that update the opposite property of their newly added valuses.
36 * <p>
37 * Example: Company<-->Employee relationship.
38 * <pre>
39 * public class Employee {
40 * </b>@BidirectionalOne(
41 * oppositeName = "employees",
42 * oppositeType = BidirectionalMany.class)
43 * private Company company;
44 * //Usual JavaBeans setters and getters go here if needed...
45 * }
46 *
47 * public class Company {
48 * </b>@BidirectionalMany(
49 * oppositeName = "company")
50 * private Collection employees;
51 * //Usual JavaBeans setters and getters go here if needed...
52 * }
53 * </pre>
54 *
55 * @author Dragan Djuric <code> dragandj@dev.java.net </code>
56 * @since 1.0
57 */
58 @Retention(RetentionPolicy.RUNTIME)
59 @Target({ElementType.FIELD})
60 public @interface BidirectionalOne {
61
62 /***
63 * The name of the opposite property.
64 * @return the name of the opposite property
65 */
66 String oppositeName();
67
68 /***
69 * The type of the opposite property. Default value is
70 * <code>BidirectionalOne.class</code>
71 */
72 Class oppositeType() default BidirectionalOne.class;
73 }