Class DefaultExpander

  • All Implemented Interfaces:
    Expander

    public class DefaultExpander
    extends java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      protected static org.slf4j.Logger logger  
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultExpander()
      Creates a new DefaultExpander
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addDSLMapping​(DSLMapping mapping)
      Add the new mapping to this expander.
      java.lang.String expand​(java.io.Reader drlReader)
      Expands (process) the expression Just-In-Time for the parser.
      java.lang.String expand​(java.lang.String drl)
      Expands (process) the expression Just-In-Time for the parser.
      java.util.List<ExpanderException> getErrors()
      Returns the list of errors from the last expansion made
      boolean hasErrors()
      Returns true in case the last expansion had any errors
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 java.lang.String expand​(java.io.Reader drlReader)
                                throws java.io.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:
        java.io.IOException
      • expand

        public java.lang.String expand​(java.lang.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 java.util.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: