Package org.ehrbase.api.exception
Class UnexpectedSwitchCaseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.ehrbase.api.exception.UnexpectedSwitchCaseException
- All Implemented Interfaces:
Serializable
This exception is thrown when a case has occurred in a switch block that cannot be handled correctly.
Typical uses in a switch statement:
- unexpected default case
- explicitly not sensibly treatable case
- unexpected default case with fall-through of not sensibly treatable case (combination of 1. and 2.)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionUnexpectedSwitchCaseException(Enum<?> enumValue) Creates a message from theenumValueparameter.
The message is based onenumValue.name(), so that the format is stable, e.g.UnexpectedSwitchCaseException(Enum<?> enumValue, String additionalMessage) Creates a message from theenumValueparameter.
The message is based onenumValue.name(), so that the format is stable, e.g.UnexpectedSwitchCaseException(Integer intValue) Creates a message from theintValueparameterUnexpectedSwitchCaseException(Integer intValue, String additionalMessage) Creates a message from theintValueparameterUnexpectedSwitchCaseException(String stringValue) Creates a message from thestringValueparameterUnexpectedSwitchCaseException(String stringValue, String additionalMessage) Creates a message from thestringValueparameter -
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatMessage(Enum<?> enumValue, String additionalMessage) Creates the message of aUnexpectedSwitchCaseExceptioncontaining the simple class name of theenumValueparameter.static StringformatMessage(Object value, String additionalMessage) Creates the message of aUnexpectedSwitchCaseExceptionbased on the given parameters.static StringformatMessage(String type, Object value, String additionalMessage) Creates the message of aUnexpectedSwitchCaseExceptionbased on the given parameters.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
UnexpectedSwitchCaseException
Creates a message from theenumValueparameter.
The message is based onenumValue.name(), so that the format is stable, e.g. in case of i18n.- Parameters:
enumValue- must not be null
-
UnexpectedSwitchCaseException
Creates a message from theenumValueparameter.
The message is based onenumValue.name(), so that the format is stable, e.g. in case of i18n.- Parameters:
enumValue- must not be nulladditionalMessage- additional text for generated message
-
UnexpectedSwitchCaseException
Creates a message from theintValueparameter- Parameters:
intValue-
-
UnexpectedSwitchCaseException
Creates a message from theintValueparameter- Parameters:
intValue-additionalMessage- additional text for generated message
-
UnexpectedSwitchCaseException
Creates a message from thestringValueparameter- Parameters:
stringValue-
-
UnexpectedSwitchCaseException
Creates a message from thestringValueparameter- Parameters:
stringValue-additionalMessage- additional text for generated message
-
-
Method Details
-
formatMessage
Creates the message of aUnexpectedSwitchCaseExceptioncontaining the simple class name of theenumValueparameter. The message is based onenumValue.name(), so that the format is stable, e.g. in case of i18n.- Parameters:
enumValue- must not be nulladditionalMessage- additional text for generated message (optional)- Returns:
-
formatMessage
Creates the message of aUnexpectedSwitchCaseExceptionbased on the given parameters.- Parameters:
value-additionalMessage- additional text for generated message (optional)- Returns:
-
formatMessage
Creates the message of aUnexpectedSwitchCaseExceptionbased on the given parameters.- Parameters:
type- e.g.enumValue.getClass().getSimpleName()value- unsupported value in switchadditionalMessage- additional text for generated message (optional)- Returns:
-