Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-3612

Prevent a trait from being applied to a given object

    Details

    • Type: Feature Request
    • Status: Resolved (View Workflow)
    • Priority: Optional
    • Resolution: Out of Date
    • Affects Version/s: None
    • Fix Version/s: FUTURE
    • Component/s: None
    • Labels:
      None
    • Affects:
      Documentation (Ref Guide, User Guide, etc.)
    • Estimated Difficulty:
      Medium

      Description

      For various reasons, a rule may want to prevent the future "don" of a given trait for a given object.

      I propose the use of the "ward" macro, as follows:

      Thing t = ward( $core, BannedTrait.class );

      If another rule, at a later point, will try to apply the BannedTrait or any of its subtypes to $core, that trait will not be applied to $core and (potentially) an exception will be thrown.

      Details:
      $core can be a @Traitable object or a Thing (i.e. an instance of a trait proxy). THe "ward" operation automatically applies the "Thing" trait to $core in case it has not been done yet.

      Optionally, one might use the "grant" macro to undo a ward (suggestions for a better name are encouraged).

      This feature will help in the implementation of "disjunct" or "mutually exclusive" traits, which are incompatible and can't be applied to the same

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                dsotty Davide Sottara
                Reporter:
                dsotty Davide Sottara
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: