Package org.jboss.logging.annotations
Annotation Type TransformException
Transforms the parameter into a new exception appending the message from
the parameter to the message from the method. This annotation is only allowed on parameters that
are a super type of the return type.
Note that the message must include a %s for the message from the parameter.
@Message("Binding to %s failed: %s")
IOException bindFailed(SocketAddress address,
@TransformException({ BindException.class, SocketException.class }) IOException toCopy);
In the above example an exception is created based on the toCopy parameter. If the toCopy parameter
is a BindException then a BindException is created and the stack trace from the
toCopy parameter is copied to the newly created exception. This will happen for each type listed as a value,
finally falling back to an IOException if the parameter is not an instance of the suggested types.
The message for the newly created exception will be; "Binding to address.toString() failed:
toCopy.getLocalizedMessage()".
- Author:
- James R. Perkins
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanIndicates if the stack trace from the parameter should be copied to the exception returned.An array of suggested types to create.
-
Element Details
-
copyStackTrace
boolean copyStackTraceIndicates if the stack trace from the parameter should be copied to the exception returned.If
true, the default, the parameters stack trace will be set as the stack trace on the newly created exception that is returned.- Returns:
trueif the stack trace should be copied to the newly created exception
- Default:
true
-
value
An array of suggested types to create. Each type must be a super type of the parameter.- Returns:
- the suggested types to create
- Default:
{}
-