Class UnexpectedCharacterException

All Implemented Interfaces:
Serializable

public class UnexpectedCharacterException extends ParseException
Thrown when attempting to consume a character of unexpected types. This exception is a wrapper exception extending ParseException.
Since:
0.8.0
See Also:
  • Field Details

    • unexpected

      private final Character unexpected
      The unexpected character.
    • position

      private final int position
      The position of the unexpected character.
    • expected

      private final VersionParser.CharType[] expected
      The array of expected character types.
  • Constructor Details

    • UnexpectedCharacterException

      UnexpectedCharacterException(UnexpectedElementException cause)
      Constructs a UnexpectedCharacterException instance with the wrapped UnexpectedElementException exception.
      Parameters:
      cause - the wrapped exception
    • UnexpectedCharacterException

      UnexpectedCharacterException(Character unexpected, int position, VersionParser.CharType... expected)
      Constructs a UnexpectedCharacterException instance with the unexpected character, its position and the expected types.
      Parameters:
      unexpected - the unexpected character
      position - the position of the unexpected character
      expected - an array of the expected character types
  • Method Details

    • getUnexpectedCharacter

      Character getUnexpectedCharacter()
      Gets the unexpected character.
      Returns:
      the unexpected character
    • getPosition

      int getPosition()
      Gets the position of the unexpected character.
      Returns:
      the position of the unexpected character
    • getExpectedCharTypes

      VersionParser.CharType[] getExpectedCharTypes()
      Gets the expected character types.
      Returns:
      an array of expected character types
    • toString

      public String toString()
      Returns the string representation of this exception containing the information about the unexpected element and, if available, about the expected types.
      Overrides:
      toString in class ParseException
      Returns:
      the string representation of this exception