Class UnexpectedCharacterException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.github.zafarkhaja.semver.ParseException
com.github.zafarkhaja.semver.UnexpectedCharacterException
- All Implemented Interfaces:
Serializable
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final VersionParser.CharType[]The array of expected character types.private final intThe position of the unexpected character.private final CharacterThe unexpected character. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs aUnexpectedCharacterExceptioninstance with the wrappedUnexpectedElementExceptionexception.UnexpectedCharacterException(Character unexpected, int position, VersionParser.CharType... expected) Constructs aUnexpectedCharacterExceptioninstance with the unexpected character, its position and the expected types. -
Method Summary
Modifier and TypeMethodDescription(package private) VersionParser.CharType[]Gets the expected character types.(package private) intGets the position of the unexpected character.(package private) CharacterGets the unexpected character.toString()Returns the string representation of this exception containing the information about the unexpected element and, if available, about the expected types.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Field Details
-
unexpected
The unexpected character. -
position
private final int positionThe position of the unexpected character. -
expected
The array of expected character types.
-
-
Constructor Details
-
UnexpectedCharacterException
UnexpectedCharacterException(UnexpectedElementException cause) Constructs aUnexpectedCharacterExceptioninstance with the wrappedUnexpectedElementExceptionexception.- Parameters:
cause- the wrapped exception
-
UnexpectedCharacterException
UnexpectedCharacterException(Character unexpected, int position, VersionParser.CharType... expected) Constructs aUnexpectedCharacterExceptioninstance with the unexpected character, its position and the expected types.- Parameters:
unexpected- the unexpected characterposition- the position of the unexpected characterexpected- an array of the expected character types
-
-
Method Details
-
getUnexpectedCharacter
-
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
Returns the string representation of this exception containing the information about the unexpected element and, if available, about the expected types.- Overrides:
toStringin classParseException- Returns:
- the string representation of this exception
-