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

Prevent a trait from being applied to a given object

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Obsolete
    • Icon: Optional Optional
    • FUTURE
    • None
    • None
    • None
    • Documentation (Ref Guide, User Guide, etc.)
    • Medium

      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

              dsotty Davide Sottara (Inactive)
              dsotty Davide Sottara (Inactive)
              Archiver:
              rhn-support-ceverson Clark Everson

                Created:
                Updated:
                Resolved:
                Archived: