Class DefaultExpanderResolver

java.lang.Object
org.drools.drl.parser.lang.dsl.DefaultExpanderResolver
All Implemented Interfaces:
ExpanderResolver

public class DefaultExpanderResolver extends Object implements ExpanderResolver
The default expander resolver will provide instances of the DefaultExpander. The DefaultExpander uses templates to provide DSL and pseudo natural language support.
  • Constructor Details

    • DefaultExpanderResolver

      public DefaultExpanderResolver()
      Create an empty resolver, which you will then call addExpander multiple times, to map a specific expander with a name that will be found in the drl after the expander keyword.
    • DefaultExpanderResolver

      public DefaultExpanderResolver(Reader reader) throws IOException
      This will load up a DSL from the reader specified. This will make the expander available to any parser regardless of name. The DSL expander will be the default expander. This is the constructor most people should use.
      Throws:
      IOException
  • Method Details

    • addExpander

      public void addExpander(String name, Expander expander)
      Add an expander with the given name, which will be used by looking for the "expander" keyword in the DRL. If a default expander is installed, it will always be returned if none matching the given name can be found. You don't need to use this unless you have multiple expanders/DSLs involved when compiling multiple rule packages at the same time. If you don't know what that sentence means, you probably don't need to use this method.
    • get

      public Expander get(String name, String config)
      Specified by:
      get in interface ExpanderResolver