java.lang.Object
de.cuioss.tools.formatting.template.lexer.Lexer<T>
Type Parameters:
T - bounds lexer to one type to avoid cross using accidentally
All Implemented Interfaces:
Serializable

public abstract class Lexer<T extends FormatterSupport> extends Object implements Serializable
Functionality of scanning plain text and split this to tokens
Author:
Eugen Fischer
See Also:
  • Constructor Details

  • Method Details

    • throwUnsupportedTokenException

      protected static final void throwUnsupportedTokenException(String wrongToken, List<String> allowedTokens)
      Throw IllegalArgumentException with information about wrong token and supported tokens
      Parameters:
      wrongToken - must not be null
      allowedTokens - must not be null
    • scan

      public abstract List<Token> scan(String input)
      Parse template into Token List according attribute list
      Parameters:
      input - template string
      Returns:
      created list of token, list could be empty if input template is null or empty
      Throws:
      IllegalArgumentException - if template include unknown token, or doesn't fit the rules
    • validateTemplate

      public final void validateTemplate(String input)
      Validate template by scan this
      Parameters:
      input - to be validated