Class DefaultExpander

  • All Implemented Interfaces:
    Expander

    public class DefaultExpander
    extends Object
    implements Expander
    The default expander uses String templates to provide pseudo natural language, as well as general DSLs. For most people, this should do the job just fine.
    • Field Detail

      • logger

        protected static final transient org.slf4j.Logger logger
    • Constructor Detail

      • DefaultExpander

        public DefaultExpander()
        Creates a new DefaultExpander
    • Method Detail

      • addDSLMapping

        public void addDSLMapping​(DSLMapping mapping)
        Add the new mapping to this expander.
        Specified by:
        addDSLMapping in interface Expander
        Parameters:
        mapping -
      • expand

        public String expand​(Reader drlReader)
                      throws IOException
        Description copied from interface: Expander
        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.
        Specified by:
        expand in interface Expander
        Parameters:
        drlReader - the source code to be pre-processed
        Returns:
        source code after running pre-processors
        Throws:
        IOException
      • expand

        public String expand​(String drl)
        Description copied from interface: Expander
        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.
        Specified by:
        expand in interface Expander
        Parameters:
        drl - the source code to be expanded
        Returns:
        source code after running pre-processors
      • getErrors

        public List<ExpanderException> getErrors()
        Description copied from interface: Expander
        Returns the list of errors from the last expansion made
        Specified by:
        getErrors in interface Expander
        Returns:
        A list of ExpanderException
      • hasErrors

        public boolean hasErrors()
        Description copied from interface: Expander
        Returns true in case the last expansion had any errors
        Specified by:
        hasErrors in interface Expander
        Returns: