Annotation Type PassByReference


  • @Retention(RUNTIME)
    @Target({METHOD,TYPE})
    @Documented
    public @interface PassByReference

    Annotation that indicates to Rhino that it can maintain the value of the CMP field by reference rather than value during the specified scope. This annotation may be used on:

    • an SBB abstract class CMP field getter or setter method.

    • an SBB or SBB part CMP extension interface CMP field getter or setter method.

    • an SBB abstract class itself.

    • an SBB or SBB part CMP extension interface.

    If the annotation is used on a class or interface declaration then its meaning is applied to all CMP fields declared in the class or interface, and also any subclass if the annotation is marked as inherited. An individual CMP field may override any pass-by-reference semantics inherited from a class or interface annotation by being annotated itself with different pass-by-reference semantics.

    If pass-by-reference semantics are desired for a CMP field that holds, either directly or indirectly, a reference to a SLEE-defined object that is only valid in the transaction it was materialised (SbbLocalObject, ProfileLocalObject, ActivityContextInterface, or EventContext), then the reference scope must be limited to PassByReference.Scope.TRANSACTIONAL to avoid runtime application failures. Note that if a CMP field storing one of these types inherits pass-by-reference semantics from a class or interface annotation, Rhino will automatically limit the scope to TRANSACTIONAL for that CMP field. This means it is not necessary to specifically annotate a CMP field directly storing one of these types if the inherited scope is wider - the correct scope will be used automatically.

    This annotation has no effect on CMP fields of primitive types or of types that Rhino understands to be immutable, eg. primitive type wrapper classes and String. Primitive types are always stored by value and immutable types are always stored by reference.

    Since:
    Rhino 2.4.0
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean inherited
      If the pass-by-reference semantics should be inherited by subclasses.
      PassByReference.Scope scope
      The scope that the reference should be maintained.
    • Element Detail

      • scope

        PassByReference.Scope scope

        The scope that the reference should be maintained.

        Since:
        Rhino 2.4.0
        Default:
        com.opencloud.rhino.cmp.PassByReference.Scope.WHILE_READY
      • inherited

        boolean inherited

        If the pass-by-reference semantics should be inherited by subclasses. This value only has meaning when the annotation is used on a class or interface declaration.

        Since:
        Rhino 2.4.0
        Default:
        true