[jboss-jira] [JBoss JIRA] (JBRULES-3612) Prevent a trait from being applied to a given object

Davide Sottara (JIRA) jira-events at lists.jboss.org
Fri Aug 31 14:42:32 EDT 2012


Davide Sottara created JBRULES-3612:
---------------------------------------

             Summary: Prevent a trait from being applied to a given object
                 Key: JBRULES-3612
                 URL: https://issues.jboss.org/browse/JBRULES-3612
             Project: Drools
          Issue Type: Feature Request
      Security Level: Public (Everyone can see)
            Reporter: Davide Sottara
            Assignee: Davide Sottara
            Priority: Optional


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 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list