- All Superinterfaces:
ErrorCodeAccessor
- All Known Implementing Classes:
AbstractException
,AbstractHiddenException
,AbstractIOException
,AbstractRuntimeException
,BugException
,DisposedException
,IntegrityException
,LockedException
,LockedException.LockedRuntimeException
,MarshalException
,RuntimeIOException
,TimeoutIOException
,UnmarshalException
,VerifyRuntimeException
,VetoException
,VetoException.VetoRuntimeException
Interface declaring base exception functionality for all of refcodes
exceptions.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.exception.ErrorCodeAccessor
ErrorCodeAccessor.ErrorCodeBuilder<B extends ErrorCodeAccessor.ErrorCodeBuilder<B>>, ErrorCodeAccessor.ErrorCodeMutator, ErrorCodeAccessor.ErrorCodeProperty
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
asLocalizedMessage
(String aMessage, Throwable aException) Creates a message from the provided message and theException
's contained localized message(s).static String
asLocalizedMessage
(Throwable aException) Generates a localized message by considering aThrowable
's causeThrowable.getCause()
as well asThrowable.getSuppressed()
exceptions.static String
WrapsMessageFormat.format(String, Object...)
to prevent failing when message cannot be formatted.static String
Creates a message from the provided message and theException
's contained message(s).static String
Generates a message by considering theThrowable
's causeThrowable.getCause()
as well asThrowable.getSuppressed()
exceptions.static String
asShortLocalizedMessage
(Throwable aException) Generates a short localized message by just considering aThrowable
's root causeThrowable.getCause()
as well asThrowable.getSuppressed()
root exceptions only.static String
asShortMessage
(Throwable aException) Generates a short message by just considering theThrowable
's root causeThrowable.getCause()
as well asThrowable.getSuppressed()
root exceptions only.default Object[]
Provides the arguments for theThrowable.getMessage()
method to create the actual message from the message pattern (passed as message argument to the exception's constructors).default String
Generates a localized message by considering aThrowable
'sThrowable.getCause()
cause as well asThrowable.getSuppressed()
exceptions.default String
Generates a message by considering aThrowable
's causeThrowable.getCause()
as well as suppressedThrowable.getSuppressed()
exceptions.default String
Generates a message using the providedFunction
method producing the message.default String
toMessage
(MessageDetails aMessageDetails) Generates a message using the providedMessageDetails
enumeration defining the message's detail level.default String
Generates a short localized message by just considering aThrowable
'sThrowable.getCause()
root cause as well as rootThrowable.getSuppressed()
exceptions only.default String
Generates a short message by just considering aThrowable
's root causeThrowable.getCause()
as well as rootThrowable.getSuppressed()
exceptions only.Methods inherited from interface org.refcodes.exception.ErrorCodeAccessor
getErrorCode
-
Method Details
-
toMessage
Generates a message using the providedMessageDetails
enumeration defining the message's detail level.- Parameters:
aMessageDetails
- TheMessageDetails
enumeration defining the message's detail level.- Returns:
- The according produced
Exception
's message.
-
toMessage
Generates a message using the providedFunction
method producing the message. -
toMessage
Generates a message by considering aThrowable
's causeThrowable.getCause()
as well as suppressedThrowable.getSuppressed()
exceptions.- Returns:
- The according more verbose
Exception
's message.
-
toLocalizedMessage
Generates a localized message by considering aThrowable
'sThrowable.getCause()
cause as well asThrowable.getSuppressed()
exceptions.- Returns:
- The according more verbose
Exception
's message.
-
toShortMessage
Generates a short message by just considering aThrowable
's root causeThrowable.getCause()
as well as rootThrowable.getSuppressed()
exceptions only.- Returns:
- The according more verbose shorter
Exception
's message.
-
toShortLocalizedMessage
Generates a short localized message by just considering aThrowable
'sThrowable.getCause()
root cause as well as rootThrowable.getSuppressed()
exceptions only.- Returns:
- The according more verbose shorter
Exception
's message.
-
getPatternArguments
Provides the arguments for theThrowable.getMessage()
method to create the actual message from the message pattern (passed as message argument to the exception's constructors). The message pattern together with the arguments are passed to theasMessage(String, Object...)
method). Override thegetPatternArguments()
method to provide the required arguments for applyingasMessage(String, Object...)
to the message template! Providingnull
will return the message pattern untouched.- Returns:
- The arguments required to build a message from the message pattern or null if the message pattern is to be returned directly!
-
asMessage
Generates a message by considering theThrowable
's causeThrowable.getCause()
as well asThrowable.getSuppressed()
exceptions. -
asLocalizedMessage
Generates a localized message by considering aThrowable
's causeThrowable.getCause()
as well asThrowable.getSuppressed()
exceptions. -
asShortMessage
Generates a short message by just considering theThrowable
's root causeThrowable.getCause()
as well asThrowable.getSuppressed()
root exceptions only. -
asShortLocalizedMessage
Generates a short localized message by just considering aThrowable
's root causeThrowable.getCause()
as well asThrowable.getSuppressed()
root exceptions only. -
asMessage
Creates a message from the provided message and theException
's contained message(s).- Parameters:
aMessage
- The message for which to generate the message.aException
- TheThrowable
from which to produce the message details.- Returns:
- The resulting message.
-
asLocalizedMessage
Creates a message from the provided message and theException
's contained localized message(s).- Parameters:
aMessage
- The message for which to generate the message.aException
- TheThrowable
from which to produce the message details.- Returns:
- The resulting message.
-
asMessage
WrapsMessageFormat.format(String, Object...)
to prevent failing when message cannot be formatted. Also expands any arrays passed inside the arguments to a comma separatedString
of the array's elements as ofArrays.toString(Object[])
without the square braces: In case such an expanded array's length is 0, then the according placeholder (such as "{0}", "{1}" and "{2}" and so on) is preserved in the resultingString
!- Parameters:
aMessage
- The message to be formatted by substituting the placeholder ("{0}", "{1}" and "{2}" and so on) with the according arguemtns's elements.aArguments
- the arguments The arguments which are used for substitution.- Returns:
- The substituted message.
-