站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss RULES 3.0.6 API 英文版文档

Expander - JBoss RULES 3.0.6 API 英文版文档


org.drools.lang
Interface Expander

All Known Implementing Classes:
DefaultExpander

public interface Expander

Expanders are extension points for expanding expressions in DRL at parse time. This is just-in-time translation, or macro expansion, or whatever you want. The important thing is that it happens at the last possible moment, so any errors in expansion are included in the parsers errors. Just-in-time expansions may include complex pre-compilers, or just macros, and everything in between. Expanders should ideally not make presumptions on any embedded semantic language. For instance, java aware pre processing should be done in drools-java semantic module, not in the parser itself. Expanders should be reusable across semantic languages.


Method Summary
 java.lang.String expand(java.lang.String scope, java.lang.String pattern)
          The parser should call this on an expression/line that potentially needs expanding BEFORE it parses that line (as the line may change radically as the result of expansion).
 

Method Detail

expand

java.lang.String expand(java.lang.String scope,
                        java.lang.String pattern)
The parser should call this on an expression/line that potentially needs expanding BEFORE it parses that line (as the line may change radically as the result of expansion). Expands the expression Just-In-Time for the parser. If the expression is not meant to be expanded, or if no appropriate expander is found, it will echo back the same expression.

Parameters:
scope - The current scope of the expansion (eg "when" for LHS)
expression - The line of text to be expanded.
Returns:
A correct expression for the parser to reparse.