Class UnexpectedElementException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.github.zafarkhaja.semver.util.UnexpectedElementException
- All Implemented Interfaces:
Serializable
Thrown when attempting to consume a stream element of unexpected types.
- Since:
- 0.7.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stream.ElementType<?>[]The array of the expected element types.private final intThe position of the unexpected element in the stream.private final ObjectThe unexpected element in the stream. -
Constructor Summary
ConstructorsConstructorDescriptionUnexpectedElementException(Object element, int position, Stream.ElementType<?>... expected) Constructs aUnexpectedElementExceptioninstance with the unexpected element and the expected types. -
Method Summary
Modifier and TypeMethodDescriptionStream.ElementType<?>[]Gets the expected element types.intGets the position of the unexpected element.Gets the unexpected element.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 element in the stream. -
position
private final int positionThe position of the unexpected element in the stream. -
expected
The array of the expected element types.
-
-
Constructor Details
-
UnexpectedElementException
UnexpectedElementException(Object element, int position, Stream.ElementType<?>... expected) Constructs aUnexpectedElementExceptioninstance with the unexpected element and the expected types.- Parameters:
element- the unexpected element in the streamposition- the position of the unexpected elementexpected- an array of the expected element types
-
-
Method Details
-
getUnexpectedElement
-
getPosition
public int getPosition()Gets the position of the unexpected element.- Returns:
- the position of the unexpected element
-
getExpectedElementTypes
Gets the expected element types.- Returns:
- an array of expected element types
-
toString
-