com.enspire.gemini.annotation
Annotation Type BidirectionalMany


@Retention(value=RUNTIME)
@Target(value=FIELD)
public @interface BidirectionalMany

e-nspire site

Fields annotated as @BidirectionalMany represent container bidirectional fields (which together with setters/getters form JavaBean properties). Bidirectional properties are JavaBean properties that update the opposite property of their newly added values.

Example: Company<-->Employee relationship.

 public class Employee {
      @BidirectionalOne(
          oppositeName = "employees",
          oppositeType = BidirectionalMany.class)
      private Company company;
      //Usual JavaBeans setters and getters go here if needed...
 }
 
 public class Company {
      @BidirectionalMany(
          oppositeName = "company")
      private Collection employees;
      //Usual JavaBeans setters and getters go here if needed...
 }
 

Since:
1.0
Author:
Dragan Djuric dragandj@dev.java.net

Required Element Summary
 java.lang.String oppositeName
          The name of the opposite property.
 
Optional Element Summary
 boolean initOnlyFirstTime
          Denotes whether the property should be initialized with a bidirectional wraper only at first setting or always.
 java.lang.Class oppositeType
          The type of the opposite property.
 

Element Detail

oppositeName

public abstract java.lang.String oppositeName
The name of the opposite property.

Returns:
the name of the opposite property

initOnlyFirstTime

public abstract boolean initOnlyFirstTime
Denotes whether the property should be initialized with a bidirectional wraper only at first setting or always.

The default value is false, and this is the option that most often does not need to be changed. However, some frameworks (for example, Hibernate) have their own wrappers for properties that are collections, lists etc, that should NOT be changed when once are set. If you have such a requirement, set this value to true and the initialization will be performed only on the first setting (while property value is still null).

Returns:
whether the initialization of bidirectional wrapper is performed only when the old value of the property was null
Default:
false

oppositeType

public abstract java.lang.Class oppositeType
The type of the opposite property. Default value is BidirectionalOne.class

Default:
com.enspire.gemini.annotation.BidirectionalOne.class


Copyright © 2005 e-nspire. All Rights Reserved.