[rules-dev] @metadata: status; compatibility issues

Wolfgang Laun wolfgang.laun at gmail.com
Fri Apr 29 04:21:34 EDT 2011


The current parser handles metadata annotations

  '@' *Identifier* '(' *Text* ')'

so that the annotations for one entity (e.g., a rule) are available as a
Map<String,Object>, where the key is given by the *Identifier *and the value
of the entry is available according to

*if*  *Text* can be *completely* parsed as   *Identifier* '='
*Expression*(where
*Expression*  is whatever the DRL parser accepts as an expression, i.e., an
extended subset of Java expressions)
   *then*
      the value is a Map<String,String>
   *else
     the *value is a String, with trimmed leading and trailing white space,
but preserving all embedded white space

Changes compared to 5.1.1:
   - no Map was ever returned in 5.1.1,
   - @m( "foo" ) in 5.1.1. returned "foo", but 5.2.0 returns "\"foo\"".
   - @m( "foo", "bar" ) in 5.1.1. returned "foo\", \"bar", but 5.2.0 returns
"\"foo\", \"bar\""
   - comments between "@...(" and ")" are now handled consistently but were
not in 5.1.1

Possibly considered a problem for 5.2.0 or later:
- No check is made for duplicate "outer" map keys; entries are overwritten.
- Repeated "inner" map keys produce concatenated entries, e.g. @m( k = 1, k
= "a" ) returns "1a" as the value for key "k".
- Returning (arbitrary) expressions, unchanged, as String now may cause
incompatibilitie with more sophisticated processing (if this ever should be
considered).

-W
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20110429/2638836b/attachment.html 


More information about the rules-dev mailing list