Class DefaultModelineParser

java.lang.Object
org.apache.camel.dsl.modeline.DefaultModelineParser
All Implemented Interfaces:
ModelineParser

public class DefaultModelineParser extends Object implements ModelineParser
  • Field Details

  • Constructor Details

    • DefaultModelineParser

      public DefaultModelineParser()
  • Method Details

    • addTrait

      public void addTrait(Trait trait)
      Description copied from interface: ModelineParser
      Adds the Trait to the parser
      Specified by:
      addTrait in interface ModelineParser
      Parameters:
      trait - the trait
    • parse

      public List<org.apache.camel.spi.CamelContextCustomizer> parse(org.apache.camel.spi.Resource resource) throws Exception
      Description copied from interface: ModelineParser
      Parses the resource to detect modelines and process them via Traits
      Specified by:
      parse in interface ModelineParser
      Parameters:
      resource - the source code resource
      Returns:
      list of CamelContextCustomizer customizers that processes the modelines
      Throws:
      Exception - is thrown if error during parsing
    • parse

      protected List<org.apache.camel.spi.CamelContextCustomizer> parse(org.apache.camel.spi.Resource resource, String line)
    • parseModeline

      public Trait parseModeline(org.apache.camel.spi.Resource resource, String key, String value)
      Description copied from interface: ModelineParser
      A modeline was detected while parsing
      Specified by:
      parseModeline in interface ModelineParser
      Parameters:
      resource - the resource
      key - the mode line key
      value - the mode line value
      Returns:
      the trait that handles the detected modeline
    • isModeline

      public boolean isModeline(String line)
      Description copied from interface: ModelineParser
      Is the given source code line a modeline?
      Specified by:
      isModeline in interface ModelineParser
      Parameters:
      line - the source code line
      Returns:
      true if modeline, false if not