Top Description Methods
org.jboss.logging.annotations

public @Interface TransformException

extends Annotation
Annotations
@Retention:CLASS
@Target:PARAMETER
@Documented
Static Imports
java.lang.annotation.ElementType.PARAMETER, .RetentionPolicy.CLASS

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 java.net.BindException then a java.net.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 java.io.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

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the stack trace should be copied to the newly created exception
copyStackTrace
()

Indicates if the stack trace from the parameter should be copied to the exception returned.

public Class<? extends Throwable>[]

Returns:

the suggested types to create
value
()

An array of suggested types to create.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

copyStackTraceback to summary
public boolean copyStackTrace()

Indicates 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:boolean

true if the stack trace should be copied to the newly created exception

valueback to summary
public Class<? extends Throwable>[] value()

An array of suggested types to create. Each type must be a super type of the parameter.

Returns:Class<? extends Throwable>[]

the suggested types to create