View Javadoc

1   /*
2   * E-nspire Gemini.
3   * A Java and AspectJ based framework that enables transparent 
4   * bidirectional relationships between Plain Old Java Objects.
5   * 
6   * Copyright (C) 2005 Dragan Djuric
7   * 
8   * This program is free software; you can redistribute it and/or
9   * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  * 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  * 
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21  * 
22  * Contact the author at dragand@dev.java.net
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  }