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

Expander (Drools 4.0.0.11754MR2 API) - JBoss RULES 4.0.0.11754MR2 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.

Author:
Michael Neale

Method Summary
 void addDSLMapping(DSLMapping mapping)
          Add the new mapping to this expander.
 String expand(Reader drl)
          Expands (process) the expression Just-In-Time for the parser.
 String expand(String source)
          Expands (process) the expression Just-In-Time for the parser.
 List getErrors()
          Returns the list of errors from the last expansion made
 boolean hasErrors()
          Returns true in case the last expansion had any errors
 

Method Detail

expand

String expand(Reader drl)
              throws IOException
Expands (process) the expression Just-In-Time for the parser. If the source is not meant to be expanded, or if no appropriate match was found for expansion, it will echo back the same expression.

Parameters:
drl - the source code to be pre-processed
Returns:
source code after running pre-processors
Throws:
IOException

expand

String expand(String source)
Expands (process) the expression Just-In-Time for the parser. If the source is not meant to be expanded, or if no appropriate match was found for expansion, it will echo back the same expression.

Parameters:
source - the source code to be expanded
Returns:
source code after running pre-processors

addDSLMapping

void addDSLMapping(DSLMapping mapping)
Add the new mapping to this expander.

Parameters:
mapping -

getErrors

List getErrors()
Returns the list of errors from the last expansion made

Returns:
A list of ExpanderException

hasErrors

boolean hasErrors()
Returns true in case the last expansion had any errors

Returns:


Copyright © 2001-2007 JBoss Inc.. All Rights Reserved.